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

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: Comments. 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
« no previous file with comments | « no previous file | content/common/gpu/media/gpu_video_decode_accelerator.cc » ('j') | media/base/video_decoder.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+
+ // Connect the PictureBuffer to the decoded frame, via whatever mechanism the
+ // strategy likes.
+ strategy_->UseCodecBufferForPictureBuffer(codec_buffer_index, i->second);
}
void AndroidVideoDecodeAccelerator::Decode(
« no previous file with comments | « no previous file | content/common/gpu/media/gpu_video_decode_accelerator.cc » ('j') | media/base/video_decoder.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698