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

Unified Diff: media/gpu/android_video_decode_accelerator.cc

Issue 1918623002: Use the MediaCodec flush workaround in more cases (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add TargetApi annotation Created 4 years, 5 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/base/android/sdk_media_codec_bridge.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/gpu/android_video_decode_accelerator.cc
diff --git a/media/gpu/android_video_decode_accelerator.cc b/media/gpu/android_video_decode_accelerator.cc
index 7a0326297acc1250d255ad875f684b18bd39ed55..41b1f28fec18d1a78bd58ff270103c8fa361966c 100644
--- a/media/gpu/android_video_decode_accelerator.cc
+++ b/media/gpu/android_video_decode_accelerator.cc
@@ -1275,7 +1275,7 @@ void AndroidVideoDecodeAccelerator::ResetCodecState() {
if (pending_input_buf_index_ != -1) {
// The data for that index exists in the input buffer, but corresponding
- // shm block been deleted. Check that it is safe to flush the coec, i.e.
+ // shm block been deleted. Check that it is safe to flush the codec, i.e.
// |pending_bitstream_records_| is empty.
// TODO(timav): keep shm block for that buffer and remove this restriction.
DCHECK(pending_bitstream_records_.empty());
@@ -1302,12 +1302,9 @@ void AndroidVideoDecodeAccelerator::ResetCodecState() {
// conservative approach and let the errors post.
// TODO(liberato): revisit this once we sort out the error state a bit more.
- // When the codec is not in error state we can flush() for JB-MR2 and beyond.
- // Prior to JB-MR2, flush() had several bugs (b/8125974, b/8347958) so we must
- // delete the MediaCodec and create a new one. The full reconfigure is much
- // slower and may cause visible freezing if done mid-stream.
+ // Flush the codec if possible, or create a new one if not.
if (!did_codec_error_happen &&
- base::android::BuildInfo::GetInstance()->sdk_int() >= 18) {
+ !media::MediaCodecUtil::CodecNeedsFlushWorkaround(media_codec_.get())) {
DVLOG(3) << __FUNCTION__ << " Flushing MediaCodec.";
media_codec_->Flush();
// Since we just flushed all the output buffers, make sure that nothing is
« no previous file with comments | « media/base/android/sdk_media_codec_bridge.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698