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

Side by Side Diff: media/gpu/ipc/client/gpu_video_decode_accelerator_host.cc

Issue 1942123002: Plumb decoded video pixel format from GPU process to renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/gpu/ipc/client/gpu_video_decode_accelerator_host.h" 5 #include "media/gpu/ipc/client/gpu_video_decode_accelerator_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 } 173 }
174 174
175 void GpuVideoDecodeAcceleratorHost::Destroy() { 175 void GpuVideoDecodeAcceleratorHost::Destroy() {
176 DCHECK(CalledOnValidThread()); 176 DCHECK(CalledOnValidThread());
177 if (channel_) 177 if (channel_)
178 Send(new AcceleratedVideoDecoderMsg_Destroy(decoder_route_id_)); 178 Send(new AcceleratedVideoDecoderMsg_Destroy(decoder_route_id_));
179 client_ = NULL; 179 client_ = NULL;
180 delete this; 180 delete this;
181 } 181 }
182 182
183 VideoPixelFormat GpuVideoDecodeAcceleratorHost::GetOutputFormat() const {
184 return picture_buffer_format_;
185 }
186
183 void GpuVideoDecodeAcceleratorHost::OnWillDeleteImpl() { 187 void GpuVideoDecodeAcceleratorHost::OnWillDeleteImpl() {
184 DCHECK(CalledOnValidThread()); 188 DCHECK(CalledOnValidThread());
185 impl_ = NULL; 189 impl_ = NULL;
186 190
187 // The gpu::CommandBufferProxyImpl is going away; error out this VDA. 191 // The gpu::CommandBufferProxyImpl is going away; error out this VDA.
188 OnChannelError(); 192 OnChannelError();
189 } 193 }
190 194
191 void GpuVideoDecodeAcceleratorHost::PostNotifyError(Error error) { 195 void GpuVideoDecodeAcceleratorHost::PostNotifyError(Error error) {
192 DCHECK(CalledOnValidThread()); 196 DCHECK(CalledOnValidThread());
(...skipping 19 matching lines...) Expand all
212 } 216 }
213 217
214 void GpuVideoDecodeAcceleratorHost::OnBitstreamBufferProcessed( 218 void GpuVideoDecodeAcceleratorHost::OnBitstreamBufferProcessed(
215 int32_t bitstream_buffer_id) { 219 int32_t bitstream_buffer_id) {
216 DCHECK(CalledOnValidThread()); 220 DCHECK(CalledOnValidThread());
217 if (client_) 221 if (client_)
218 client_->NotifyEndOfBitstreamBuffer(bitstream_buffer_id); 222 client_->NotifyEndOfBitstreamBuffer(bitstream_buffer_id);
219 } 223 }
220 224
221 void GpuVideoDecodeAcceleratorHost::OnProvidePictureBuffer( 225 void GpuVideoDecodeAcceleratorHost::OnProvidePictureBuffer(
226 VideoPixelFormat format,
222 uint32_t num_requested_buffers, 227 uint32_t num_requested_buffers,
223 uint32_t textures_per_buffer, 228 uint32_t textures_per_buffer,
224 const gfx::Size& dimensions, 229 const gfx::Size& dimensions,
225 uint32_t texture_target) { 230 uint32_t texture_target) {
226 DCHECK(CalledOnValidThread()); 231 DCHECK(CalledOnValidThread());
227 picture_buffer_dimensions_ = dimensions; 232 picture_buffer_dimensions_ = dimensions;
233 picture_buffer_format_ = format;
228 234
229 const int kMaxVideoPlanes = 4; 235 const int kMaxVideoPlanes = 4;
230 if (textures_per_buffer > kMaxVideoPlanes) { 236 if (textures_per_buffer > kMaxVideoPlanes) {
231 PostNotifyError(PLATFORM_FAILURE); 237 PostNotifyError(PLATFORM_FAILURE);
232 return; 238 return;
233 } 239 }
234 240
235 if (client_) { 241 if (client_) {
236 client_->ProvidePictureBuffers(num_requested_buffers, textures_per_buffer, 242 client_->ProvidePictureBuffers(num_requested_buffers, textures_per_buffer,
237 dimensions, texture_target); 243 dimensions, texture_target);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 weak_this_factory_.InvalidateWeakPtrs(); 285 weak_this_factory_.InvalidateWeakPtrs();
280 286
281 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the 287 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the
282 // last thing done on this stack! 288 // last thing done on this stack!
283 VideoDecodeAccelerator::Client* client = NULL; 289 VideoDecodeAccelerator::Client* client = NULL;
284 std::swap(client, client_); 290 std::swap(client, client_);
285 client->NotifyError(static_cast<VideoDecodeAccelerator::Error>(error)); 291 client->NotifyError(static_cast<VideoDecodeAccelerator::Error>(error));
286 } 292 }
287 293
288 } // namespace media 294 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698