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

Side by Side Diff: media/filters/gpu_video_decoder.cc

Issue 426873004: Pass decoded picture size from VDA to client (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix android build Created 6 years, 4 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
« no previous file with comments | « content/renderer/pepper/video_decoder_shim.cc ('k') | media/video/picture.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/filters/gpu_video_decoder.h" 5 #include "media/filters/gpu_video_decoder.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 415
416 PictureBufferMap::iterator it = 416 PictureBufferMap::iterator it =
417 assigned_picture_buffers_.find(picture.picture_buffer_id()); 417 assigned_picture_buffers_.find(picture.picture_buffer_id());
418 if (it == assigned_picture_buffers_.end()) { 418 if (it == assigned_picture_buffers_.end()) {
419 NOTREACHED() << "Missing picture buffer: " << picture.picture_buffer_id(); 419 NOTREACHED() << "Missing picture buffer: " << picture.picture_buffer_id();
420 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE); 420 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE);
421 return; 421 return;
422 } 422 }
423 const PictureBuffer& pb = it->second; 423 const PictureBuffer& pb = it->second;
424 424
425 // Validate picture rectangle from GPU. This is for sanity/security check
426 // even the rectangle is not used in this class.
427 if (picture.visible_rect().IsEmpty() ||
428 !gfx::Rect(pb.size()).Contains(picture.visible_rect())) {
429 NOTREACHED() << "Invalid picture size from VDA: "
430 << picture.visible_rect().ToString() << " should fit in "
431 << pb.size().ToString();
432 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
433 return;
434 }
435
425 // Update frame's timestamp. 436 // Update frame's timestamp.
426 base::TimeDelta timestamp; 437 base::TimeDelta timestamp;
438 // Some of the VDAs don't support and thus don't provide us with visible
439 // size in picture.size, passing coded size instead, so always drop it and
440 // use config information instead.
427 gfx::Rect visible_rect; 441 gfx::Rect visible_rect;
428 gfx::Size natural_size; 442 gfx::Size natural_size;
429 GetBufferData(picture.bitstream_buffer_id(), &timestamp, &visible_rect, 443 GetBufferData(picture.bitstream_buffer_id(), &timestamp, &visible_rect,
430 &natural_size); 444 &natural_size);
431 DCHECK(decoder_texture_target_); 445 DCHECK(decoder_texture_target_);
432 446
433 scoped_refptr<VideoFrame> frame(VideoFrame::WrapNativeTexture( 447 scoped_refptr<VideoFrame> frame(VideoFrame::WrapNativeTexture(
434 make_scoped_ptr(new gpu::MailboxHolder( 448 make_scoped_ptr(new gpu::MailboxHolder(
435 pb.texture_mailbox(), decoder_texture_target_, 0 /* sync_point */)), 449 pb.texture_mailbox(), decoder_texture_target_, 0 /* sync_point */)),
436 BindToCurrentLoop(base::Bind(&GpuVideoDecoder::ReleaseMailbox, 450 BindToCurrentLoop(base::Bind(&GpuVideoDecoder::ReleaseMailbox,
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 DLOG(ERROR) << "VDA Error: " << error; 616 DLOG(ERROR) << "VDA Error: " << error;
603 DestroyVDA(); 617 DestroyVDA();
604 } 618 }
605 619
606 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() 620 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent()
607 const { 621 const {
608 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); 622 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread());
609 } 623 }
610 624
611 } // namespace media 625 } // namespace media
OLDNEW
« no previous file with comments | « content/renderer/pepper/video_decoder_shim.cc ('k') | media/video/picture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698