Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: content/common/gpu/media/gpu_video_encode_accelerator.cc

Issue 170843004: Pass Client pointer in Initialize() for VDA/VEA (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 50e826de Rebase. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/gpu/media/gpu_video_encode_accelerator.h" 5 #include "content/common/gpu/media/gpu_video_encode_accelerator.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 profiles = AndroidVideoEncodeAccelerator::GetSupportedProfiles(); 94 profiles = AndroidVideoEncodeAccelerator::GetSupportedProfiles();
95 #endif 95 #endif
96 96
97 // TODO(sheu): return platform-specific profiles. 97 // TODO(sheu): return platform-specific profiles.
98 return profiles; 98 return profiles;
99 } 99 }
100 100
101 void GpuVideoEncodeAccelerator::CreateEncoder() { 101 void GpuVideoEncodeAccelerator::CreateEncoder() {
102 DCHECK(!encoder_); 102 DCHECK(!encoder_);
103 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_X11) 103 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_X11)
104 encoder_.reset(new ExynosVideoEncodeAccelerator(this)); 104 encoder_.reset(new ExynosVideoEncodeAccelerator());
105 #elif defined(OS_ANDROID) && defined(ENABLE_WEBRTC) 105 #elif defined(OS_ANDROID) && defined(ENABLE_WEBRTC)
106 encoder_.reset(new AndroidVideoEncodeAccelerator(this)); 106 encoder_.reset(new AndroidVideoEncodeAccelerator());
107 #endif 107 #endif
108 } 108 }
109 109
110 void GpuVideoEncodeAccelerator::OnInitialize( 110 void GpuVideoEncodeAccelerator::OnInitialize(
111 media::VideoFrame::Format input_format, 111 media::VideoFrame::Format input_format,
112 const gfx::Size& input_visible_size, 112 const gfx::Size& input_visible_size,
113 media::VideoCodecProfile output_profile, 113 media::VideoCodecProfile output_profile,
114 uint32 initial_bitrate) { 114 uint32 initial_bitrate) {
115 DVLOG(2) << "GpuVideoEncodeAccelerator::OnInitialize(): " 115 DVLOG(2) << "GpuVideoEncodeAccelerator::OnInitialize(): "
116 "input_format=" << input_format 116 "input_format=" << input_format
(...skipping 13 matching lines...) Expand all
130 } 130 }
131 131
132 CreateEncoder(); 132 CreateEncoder();
133 if (!encoder_) { 133 if (!encoder_) {
134 DLOG(ERROR) << "GpuVideoEncodeAccelerator::OnInitialize(): VEA creation " 134 DLOG(ERROR) << "GpuVideoEncodeAccelerator::OnInitialize(): VEA creation "
135 "failed"; 135 "failed";
136 NotifyError(media::VideoEncodeAccelerator::kPlatformFailureError); 136 NotifyError(media::VideoEncodeAccelerator::kPlatformFailureError);
137 return; 137 return;
138 } 138 }
139 encoder_->Initialize( 139 encoder_->Initialize(
140 input_format, input_visible_size, output_profile, initial_bitrate); 140 input_format, input_visible_size, output_profile, initial_bitrate, this);
141 input_format_ = input_format; 141 input_format_ = input_format;
142 input_visible_size_ = input_visible_size; 142 input_visible_size_ = input_visible_size;
143 } 143 }
144 144
145 void GpuVideoEncodeAccelerator::OnEncode(int32 frame_id, 145 void GpuVideoEncodeAccelerator::OnEncode(int32 frame_id,
146 base::SharedMemoryHandle buffer_handle, 146 base::SharedMemoryHandle buffer_handle,
147 uint32 buffer_size, 147 uint32 buffer_size,
148 bool force_keyframe) { 148 bool force_keyframe) {
149 DVLOG(3) << "GpuVideoEncodeAccelerator::OnEncode(): frame_id=" << frame_id 149 DVLOG(3) << "GpuVideoEncodeAccelerator::OnEncode(): frame_id=" << frame_id
150 << ", buffer_size=" << buffer_size 150 << ", buffer_size=" << buffer_size
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 return; 247 return;
248 } else if (!channel_->Send(message)) { 248 } else if (!channel_->Send(message)) {
249 DLOG(ERROR) << "GpuVideoEncodeAccelerator::Send(): sending failed: " 249 DLOG(ERROR) << "GpuVideoEncodeAccelerator::Send(): sending failed: "
250 "message->type()=" << message->type(); 250 "message->type()=" << message->type();
251 NotifyError(media::VideoEncodeAccelerator::kPlatformFailureError); 251 NotifyError(media::VideoEncodeAccelerator::kPlatformFailureError);
252 return; 252 return;
253 } 253 }
254 } 254 }
255 255
256 } // namespace content 256 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/media/gpu_video_decode_accelerator.cc ('k') | content/common/gpu/media/v4l2_video_decode_accelerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698