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

Unified Diff: media/filters/gpu_video_decoder.cc

Issue 14199002: Send hardware video frames with mailboxes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: video-mailbox: remove extra produce in webmediaplayer_impl Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/gpu_video_decoder.h ('k') | media/media.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/gpu_video_decoder.cc
diff --git a/media/filters/gpu_video_decoder.cc b/media/filters/gpu_video_decoder.cc
index 31c550b3a1ed08dfe849c41970d7873f8a531bf3..7842d9ed1e981b0f72a1470c840a84cdc78581a5 100644
--- a/media/filters/gpu_video_decoder.cc
+++ b/media/filters/gpu_video_decoder.cc
@@ -495,13 +495,27 @@ void GpuVideoDecoder::ProvidePictureBuffers(uint32 count,
DCHECK(gvd_loop_proxy_->BelongsToCurrentThread());
std::vector<uint32> texture_ids;
+ std::vector<gpu::Mailbox> texture_mailboxes;
decoder_texture_target_ = texture_target;
- if (!factories_->CreateTextures(
- count, size, &texture_ids, decoder_texture_target_)) {
+ if (!factories_->CreateTextures(count,
+ size,
+ &texture_ids,
+ &texture_mailboxes,
+ decoder_texture_target_)) {
NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE);
return;
}
DCHECK_EQ(count, texture_ids.size());
+ DCHECK_EQ(count, texture_mailboxes.size());
+
+ for (size_t i = 0; i < count; ++i) {
+ // Discards the sync point returned here since PictureReady will imply that
+ // the produce has already happened, and the texture is ready for use.
+ factories_->ProduceTexturesToMailboxes(
piman 2013/06/14 22:55:28 Why not do that directly inside of CreateTextures?
danakj 2013/06/15 00:12:58 It seemed more flexible for the future and stuff t
piman 2013/06/15 00:42:19 My thinking is that, we already know we're associa
+ texture_mailboxes,
+ texture_ids,
+ decoder_texture_target_);
+ }
if (!vda_)
return;
@@ -509,7 +523,7 @@ void GpuVideoDecoder::ProvidePictureBuffers(uint32 count,
std::vector<PictureBuffer> picture_buffers;
for (size_t i = 0; i < texture_ids.size(); ++i) {
picture_buffers.push_back(PictureBuffer(
- next_picture_buffer_id_++, size, texture_ids[i]));
+ next_picture_buffer_id_++, size, texture_ids[i], texture_mailboxes[i]));
bool inserted = assigned_picture_buffers_.insert(std::make_pair(
picture_buffers.back().id(), picture_buffers.back())).second;
DCHECK(inserted);
@@ -570,16 +584,20 @@ void GpuVideoDecoder::PictureReady(const media::Picture& picture) {
GetBufferData(picture.bitstream_buffer_id(), &timestamp, &visible_rect,
&natural_size);
DCHECK(decoder_texture_target_);
+
scoped_refptr<VideoFrame> frame(
VideoFrame::WrapNativeTexture(
- pb.texture_id(), decoder_texture_target_, pb.size(), visible_rect,
+ pb.texture_mailbox(), 0,
+ decoder_texture_target_,
+ pb.size(), visible_rect,
natural_size, timestamp,
base::Bind(&Factories::ReadPixels, factories_, pb.texture_id(),
decoder_texture_target_,
gfx::Size(visible_rect.width(), visible_rect.height())),
BindToCurrentLoop(base::Bind(
&GpuVideoDecoder::ReusePictureBuffer, weak_this_,
- picture.picture_buffer_id()))));
+ picture.picture_buffer_id())),
+ base::Closure()));
CHECK_GT(available_pictures_, 0);
--available_pictures_;
bool inserted =
@@ -610,7 +628,8 @@ void GpuVideoDecoder::EnqueueFrameAndTriggerFrameDelivery(
ready_video_frames_.pop_front();
}
-void GpuVideoDecoder::ReusePictureBuffer(int64 picture_buffer_id) {
+void GpuVideoDecoder::ReusePictureBuffer(int64 picture_buffer_id,
+ uint32 sync_point) {
DCHECK(gvd_loop_proxy_->BelongsToCurrentThread());
if (!vda_)
@@ -633,8 +652,11 @@ void GpuVideoDecoder::ReusePictureBuffer(int64 picture_buffer_id) {
return;
}
+ factories_->WaitSyncPoint(sync_point);
+
++available_pictures_;
+
vda_loop_proxy_->PostTask(FROM_HERE, base::Bind(
&VideoDecodeAccelerator::ReusePictureBuffer, weak_vda_,
picture_buffer_id));
« no previous file with comments | « media/filters/gpu_video_decoder.h ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698