Chromium Code Reviews| Index: media/base/android/media_codec_video_decoder.cc | 
| diff --git a/media/base/android/media_codec_video_decoder.cc b/media/base/android/media_codec_video_decoder.cc | 
| index f44b81931bdb0f343953f85aa7260d915719e7a0..81218163afcd14a9f2664eaedd4c906e9efa8e6b 100644 | 
| --- a/media/base/android/media_codec_video_decoder.cc | 
| +++ b/media/base/android/media_codec_video_decoder.cc | 
| @@ -75,18 +75,18 @@ void MediaCodecVideoDecoder::ReleaseDecoderResources() { | 
| delayed_buffers_.clear(); | 
| } | 
| -void MediaCodecVideoDecoder::SetPendingSurface(gfx::ScopedJavaSurface surface) { | 
| +void MediaCodecVideoDecoder::SetVideoSurface(gfx::ScopedJavaSurface surface) { | 
| DCHECK(media_task_runner_->BelongsToCurrentThread()); | 
| + DVLOG(1) << class_name() << "::" << __FUNCTION__ | 
| + << (surface.IsEmpty() ? " empty" : " non-empty"); | 
| + | 
| surface_ = surface.Pass(); | 
| - if (surface_.IsEmpty()) { | 
| - // Synchronously stop decoder thread and release MediaCodec | 
| - ReleaseDecoderResources(); | 
| - } | 
| + needs_reconfigure_ = true; | 
| } | 
| -bool MediaCodecVideoDecoder::HasPendingSurface() const { | 
| +bool MediaCodecVideoDecoder::HasVideoSurface() const { | 
| DCHECK(media_task_runner_->BelongsToCurrentThread()); | 
| return !surface_.IsEmpty(); | 
| @@ -120,12 +120,12 @@ MediaCodecDecoder::ConfigStatus MediaCodecVideoDecoder::ConfigureInternal() { | 
| // If we cannot find a key frame in cache, the browser seek is needed. | 
| if (!au_queue_.RewindToLastKeyFrame()) { | 
| DVLOG(1) << class_name() << "::" << __FUNCTION__ << " key frame required"; | 
| + return CONFIG_KEY_FRAME_REQUIRED; | 
| + } | 
| - // The processing of CONFIG_KEY_FRAME_REQUIRED is not implemented yet, | 
| - // return error for now. | 
| - // TODO(timav): Replace this with the following line together with | 
| - // implementing the browser seek: | 
| - // return CONFIG_KEY_FRAME_REQUIRED; | 
| + if (configs_.video_codec == kUnknownVideoCodec) { | 
| + DVLOG(0) << class_name() << "::" << __FUNCTION__ | 
| + << " configuration parameters are required"; | 
| return CONFIG_FAILURE; | 
| } | 
| @@ -244,6 +244,11 @@ void MediaCodecVideoDecoder::ReleaseDelayedBuffers() { | 
| delayed_buffers_.clear(); | 
| } | 
| +void MediaCodecVideoDecoder::ClearDelayedBuffers() { | 
| 
 
qinmin
2015/07/22 17:30:33
I think you can merge this function with ReleaseDe
 
Tima Vaisburd
2015/07/23 00:37:49
Done.
 
 | 
| + // Media thread | 
| + delayed_buffers_.clear(); | 
| +} | 
| + | 
| #ifndef NDEBUG | 
| void MediaCodecVideoDecoder::VerifyUnitIsKeyFrame( | 
| const AccessUnit* unit) const { |