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 7b9843d7d1ee81a3c40ee46c888f3cd0ae1b6b0d..7b617764398e219d25cef644f4a99c9879ba89f1 100644 |
| --- a/media/base/android/media_codec_video_decoder.cc |
| +++ b/media/base/android/media_codec_video_decoder.cc |
| @@ -20,6 +20,7 @@ MediaCodecVideoDecoder::MediaCodecVideoDecoder( |
| const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, |
| const base::Closure& request_data_cb, |
| const base::Closure& starvation_cb, |
| + const base::Closure& decoder_drained_cb, |
| const base::Closure& stop_done_cb, |
| const base::Closure& error_cb, |
| const SetTimeCallback& update_current_time_cb, |
| @@ -28,12 +29,16 @@ MediaCodecVideoDecoder::MediaCodecVideoDecoder( |
| : MediaCodecDecoder(media_task_runner, |
| request_data_cb, |
| starvation_cb, |
| + decoder_drained_cb, |
| stop_done_cb, |
| error_cb, |
| "VideoDecoder"), |
| update_current_time_cb_(update_current_time_cb), |
| video_size_changed_cb_(video_size_changed_cb), |
| codec_created_cb_(codec_created_cb) { |
| + // Generate |kConfigChanged| before every key frame |
|
qinmin
2015/08/20 19:41:25
why we need this? cannot we just do that in test b
Tima Vaisburd
2015/08/20 20:05:22
It was intended not for the unit tests, but for te
|
| + // au_queue_.EmulateConfigChanges(true); |
| + // always_reconfigure_for_tests_ = true; |
| } |
| MediaCodecVideoDecoder::~MediaCodecVideoDecoder() { |
| @@ -52,12 +57,12 @@ bool MediaCodecVideoDecoder::HasStream() const { |
| } |
| void MediaCodecVideoDecoder::SetDemuxerConfigs(const DemuxerConfigs& configs) { |
| - DCHECK(media_task_runner_->BelongsToCurrentThread()); |
| - |
| DVLOG(1) << class_name() << "::" << __FUNCTION__ << " " << configs; |
| configs_ = configs; |
| + // au_queue_.SetLastConfigs(configs); |
| + |
| if (video_size_.IsEmpty()) { |
| video_size_ = configs_.video_size; |
| media_task_runner_->PostTask( |
| @@ -99,18 +104,20 @@ bool MediaCodecVideoDecoder::HasVideoSurface() const { |
| } |
| bool MediaCodecVideoDecoder::IsCodecReconfigureNeeded( |
| - const DemuxerConfigs& curr, |
| const DemuxerConfigs& next) const { |
| - if (curr.video_codec != next.video_codec || |
| - curr.is_video_encrypted != next.is_video_encrypted) { |
| + if (always_reconfigure_for_tests_) |
| + return true; |
| + |
| + if (configs_.video_codec != next.video_codec || |
| + configs_.is_video_encrypted != next.is_video_encrypted) { |
| return true; |
| } |
| // Only size changes below this point |
| - if (curr.video_size.width() == next.video_size.width() && |
| - curr.video_size.height() == next.video_size.height()) { |
| - return false; // i.e. curr == next |
| + if (configs_.video_size.width() == next.video_size.width() && |
| + configs_.video_size.height() == next.video_size.height()) { |
| + return false; // i.e. configs_ == next |
| } |
| return !static_cast<VideoCodecBridge*>(media_codec_bridge_.get()) |