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

Side by Side Diff: media/gpu/android_video_decode_accelerator.cc

Issue 2047003003: Rename MediaCodecBridge::Reset() to Flush() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: missed a couple Created 4 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 unified diff | Download patch
« no previous file with comments | « media/filters/android/media_codec_audio_decoder.cc ('k') | no next file » | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/gpu/android_video_decode_accelerator.h" 5 #include "media/gpu/android_video_decode_accelerator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 } 1212 }
1213 1213
1214 // We might increment error_sequence_token here to cancel any delayed errors, 1214 // We might increment error_sequence_token here to cancel any delayed errors,
1215 // but right now it's unclear that it's safe to do so. If we are in an error 1215 // but right now it's unclear that it's safe to do so. If we are in an error
1216 // state because of a codec error, then it would be okay. Otherwise, it's 1216 // state because of a codec error, then it would be okay. Otherwise, it's
1217 // less obvious that we are exiting the error state. Since deferred errors 1217 // less obvious that we are exiting the error state. Since deferred errors
1218 // are only intended for fullscreen transitions right now, we take the more 1218 // are only intended for fullscreen transitions right now, we take the more
1219 // conservative approach and let the errors post. 1219 // conservative approach and let the errors post.
1220 // TODO(liberato): revisit this once we sort out the error state a bit more. 1220 // TODO(liberato): revisit this once we sort out the error state a bit more.
1221 1221
1222 // When codec is not in error state we can quickly reset (internally calls 1222 // When the codec is not in error state we can flush() for JB-MR2 and beyond.
1223 // flush()) for JB-MR2 and beyond. Prior to JB-MR2, flush() had several bugs 1223 // Prior to JB-MR2, flush() had several bugs (b/8125974, b/8347958) so we must
1224 // (b/8125974, b/8347958) so we must delete the MediaCodec and create a new 1224 // delete the MediaCodec and create a new one. The full reconfigure is much
1225 // one. The full reconfigure is much slower and may cause visible freezing if 1225 // slower and may cause visible freezing if done mid-stream.
1226 // done mid-stream.
1227 if (!did_codec_error_happen && 1226 if (!did_codec_error_happen &&
1228 base::android::BuildInfo::GetInstance()->sdk_int() >= 18) { 1227 base::android::BuildInfo::GetInstance()->sdk_int() >= 18) {
1229 DVLOG(3) << __FUNCTION__ << " Doing fast MediaCodec reset (flush)."; 1228 DVLOG(3) << __FUNCTION__ << " Flushing MediaCodec.";
1230 media_codec_->Reset(); 1229 media_codec_->Flush();
1231 // Since we just flushed all the output buffers, make sure that nothing is 1230 // Since we just flushed all the output buffers, make sure that nothing is
1232 // using them. 1231 // using them.
1233 strategy_->CodecChanged(media_codec_.get()); 1232 strategy_->CodecChanged(media_codec_.get());
1234 } else { 1233 } else {
1235 DVLOG(3) << __FUNCTION__ 1234 DVLOG(3) << __FUNCTION__
1236 << " Deleting the MediaCodec and creating a new one."; 1235 << " Deleting the MediaCodec and creating a new one.";
1237 g_avda_timer.Pointer()->StopTimer(this); 1236 g_avda_timer.Pointer()->StopTimer(this);
1238 // Changing the codec will also notify the strategy to forget about any
1239 // output buffers it has currently.
1240 ConfigureMediaCodecAsynchronously(); 1237 ConfigureMediaCodecAsynchronously();
1241 } 1238 }
1242 } 1239 }
1243 1240
1244 void AndroidVideoDecodeAccelerator::Reset() { 1241 void AndroidVideoDecodeAccelerator::Reset() {
1245 DVLOG(1) << __FUNCTION__; 1242 DVLOG(1) << __FUNCTION__;
1246 DCHECK(thread_checker_.CalledOnValidThread()); 1243 DCHECK(thread_checker_.CalledOnValidThread());
1247 TRACE_EVENT0("media", "AVDA::Reset"); 1244 TRACE_EVENT0("media", "AVDA::Reset");
1248 1245
1249 while (!pending_bitstream_records_.empty()) { 1246 while (!pending_bitstream_records_.empty()) {
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 if (media::MediaCodecUtil::IsSurfaceViewOutputSupported()) { 1622 if (media::MediaCodecUtil::IsSurfaceViewOutputSupported()) {
1626 capabilities.flags |= media::VideoDecodeAccelerator::Capabilities:: 1623 capabilities.flags |= media::VideoDecodeAccelerator::Capabilities::
1627 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; 1624 SUPPORTS_EXTERNAL_OUTPUT_SURFACE;
1628 } 1625 }
1629 } 1626 }
1630 1627
1631 return capabilities; 1628 return capabilities;
1632 } 1629 }
1633 1630
1634 } // namespace media 1631 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/android/media_codec_audio_decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698