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

Unified Diff: content/common/gpu/media/android_video_decode_accelerator.cc

Issue 1921803002: Avoid unnecessary post task during frame delivery. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
Index: content/common/gpu/media/android_video_decode_accelerator.cc
diff --git a/content/common/gpu/media/android_video_decode_accelerator.cc b/content/common/gpu/media/android_video_decode_accelerator.cc
index 55b1855a546d482fd89f87b95d6361c0d89e88ab..36c11c5e2e5dc8c1d3a3729894849fd52781dfea 100644
--- a/content/common/gpu/media/android_video_decode_accelerator.cc
+++ b/content/common/gpu/media/android_video_decode_accelerator.cc
@@ -829,19 +829,20 @@ void AndroidVideoDecodeAccelerator::SendDecodedFrameToClient(
size_changed = true;
}
- // Connect the PictureBuffer to the decoded frame, via whatever
- // mechanism the strategy likes.
- strategy_->UseCodecBufferForPictureBuffer(codec_buffer_index, i->second);
-
const bool allow_overlay = strategy_->ArePicturesOverlayable();
-
media::Picture picture(picture_buffer_id, bitstream_id, gfx::Rect(size_),
allow_overlay);
picture.set_size_changed(size_changed);
- base::MessageLoop::current()->PostTask(
- FROM_HERE, base::Bind(&AndroidVideoDecodeAccelerator::NotifyPictureReady,
- weak_this_factory_.GetWeakPtr(), picture));
+ // Notify picture ready before calling UseCodecBufferForPictureBuffer() since
+ // that process may be slow and shouldn't delay delivery of the frame to the
+ // renderer. The picture is only used on the same thread as this method is
+ // called, so it is safe to do this.
+ NotifyPictureReady(picture);
liberato (no reviews please) 2016/04/25 19:58:22 how much time does this buy?
DaleCurtis 2016/04/25 22:32:22 You mean not posting or the reorder? Combined this
+
+ // Connect the PictureBuffer to the decoded frame, via whatever mechanism the
+ // strategy likes.
+ strategy_->UseCodecBufferForPictureBuffer(codec_buffer_index, i->second);
}
void AndroidVideoDecodeAccelerator::Decode(

Powered by Google App Engine
This is Rietveld 408576698