| 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..2eccc402b628a1061a19508938708cc5109d1341 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,13 +120,13 @@ 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 kConfigKeyFrameRequired;
|
| + }
|
|
|
| - // 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;
|
| - return CONFIG_FAILURE;
|
| + if (configs_.video_codec == kUnknownVideoCodec) {
|
| + DVLOG(0) << class_name() << "::" << __FUNCTION__
|
| + << " configuration parameters are required";
|
| + return kConfigFailure;
|
| }
|
|
|
| // TODO(timav): implement DRM.
|
| @@ -137,7 +137,7 @@ MediaCodecDecoder::ConfigStatus MediaCodecVideoDecoder::ConfigureInternal() {
|
|
|
| if (surface_.IsEmpty()) {
|
| DVLOG(0) << class_name() << "::" << __FUNCTION__ << " surface required";
|
| - return CONFIG_FAILURE;
|
| + return kConfigFailure;
|
| }
|
|
|
| media_codec_bridge_.reset(VideoCodecBridge::CreateDecoder(
|
| @@ -149,14 +149,14 @@ MediaCodecDecoder::ConfigStatus MediaCodecVideoDecoder::ConfigureInternal() {
|
|
|
| if (!media_codec_bridge_) {
|
| DVLOG(1) << class_name() << "::" << __FUNCTION__ << " failed";
|
| - return CONFIG_FAILURE;
|
| + return kConfigFailure;
|
| }
|
|
|
| DVLOG(1) << class_name() << "::" << __FUNCTION__ << " succeeded";
|
|
|
| media_task_runner_->PostTask(FROM_HERE, codec_created_cb_);
|
|
|
| - return CONFIG_OK;
|
| + return kConfigOk;
|
| }
|
|
|
| void MediaCodecVideoDecoder::SynchronizePTSWithTime(
|
| @@ -236,11 +236,14 @@ int MediaCodecVideoDecoder::NumDelayedRenderTasks() const {
|
| return delayed_buffers_.size();
|
| }
|
|
|
| -void MediaCodecVideoDecoder::ReleaseDelayedBuffers() {
|
| +void MediaCodecVideoDecoder::ClearDelayedBuffers(bool release) {
|
| // Media thread
|
| // Called when there is no decoder thread
|
| - for (int index : delayed_buffers_)
|
| - media_codec_bridge_->ReleaseOutputBuffer(index, false);
|
| + if (release) {
|
| + for (int index : delayed_buffers_)
|
| + media_codec_bridge_->ReleaseOutputBuffer(index, false);
|
| + }
|
| +
|
| delayed_buffers_.clear();
|
| }
|
|
|
|
|