| Index: media/base/android/media_codec_audio_decoder.cc
|
| diff --git a/media/base/android/media_codec_audio_decoder.cc b/media/base/android/media_codec_audio_decoder.cc
|
| index d938db9885f618cb06accd316b353a4e32be7986..9003e4ce443a6ef2b1ca3681e2f3dce9866d31c8 100644
|
| --- a/media/base/android/media_codec_audio_decoder.cc
|
| +++ b/media/base/android/media_codec_audio_decoder.cc
|
| @@ -26,12 +26,14 @@ MediaCodecAudioDecoder::MediaCodecAudioDecoder(
|
| 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)
|
| : MediaCodecDecoder(media_task_runner,
|
| request_data_cb,
|
| starvation_cb,
|
| + decoder_drained_cb,
|
| stop_done_cb,
|
| error_cb,
|
| "AudioDecoder"),
|
| @@ -58,8 +60,6 @@ bool MediaCodecAudioDecoder::HasStream() const {
|
| }
|
|
|
| void MediaCodecAudioDecoder::SetDemuxerConfigs(const DemuxerConfigs& configs) {
|
| - DCHECK(media_task_runner_->BelongsToCurrentThread());
|
| -
|
| DVLOG(1) << class_name() << "::" << __FUNCTION__ << " " << configs;
|
|
|
| configs_ = configs;
|
| @@ -99,14 +99,17 @@ void MediaCodecAudioDecoder::SetBaseTimestamp(base::TimeDelta base_timestamp) {
|
| }
|
|
|
| bool MediaCodecAudioDecoder::IsCodecReconfigureNeeded(
|
| - const DemuxerConfigs& curr,
|
| const DemuxerConfigs& next) const {
|
| - return curr.audio_codec != next.audio_codec ||
|
| - curr.audio_channels != next.audio_channels ||
|
| - curr.audio_sampling_rate != next.audio_sampling_rate ||
|
| + if (always_reconfigure_for_tests_)
|
| + return true;
|
| +
|
| + return configs_.audio_codec != next.audio_codec ||
|
| + configs_.audio_channels != next.audio_channels ||
|
| + configs_.audio_sampling_rate != next.audio_sampling_rate ||
|
| next.is_audio_encrypted != next.is_audio_encrypted ||
|
| - curr.audio_extra_data.size() != next.audio_extra_data.size() ||
|
| - !std::equal(curr.audio_extra_data.begin(), curr.audio_extra_data.end(),
|
| + configs_.audio_extra_data.size() != next.audio_extra_data.size() ||
|
| + !std::equal(configs_.audio_extra_data.begin(),
|
| + configs_.audio_extra_data.end(),
|
| next.audio_extra_data.begin());
|
| }
|
|
|
| @@ -188,15 +191,14 @@ void MediaCodecAudioDecoder::Render(int buffer_index,
|
| int64 head_position =
|
| audio_codec->PlayOutputBuffer(buffer_index, size, postpone);
|
|
|
| - DVLOG(2) << class_name() << "::" << __FUNCTION__ << " pts:" << pts
|
| - << (postpone ? " POSTPONE" : "")
|
| - << " head_position:" << head_position;
|
| -
|
| size_t new_frames_count = size / bytes_per_frame_;
|
| frame_count_ += new_frames_count;
|
| audio_timestamp_helper_->AddFrames(new_frames_count);
|
|
|
| - if (!postpone) {
|
| + if (postpone) {
|
| + DVLOG(2) << class_name() << "::" << __FUNCTION__ << " pts:" << pts
|
| + << " POSTPONE";
|
| + } else {
|
| int64 frames_to_play = frame_count_ - head_position;
|
|
|
| DCHECK_GE(frames_to_play, 0) << class_name() << "::" << __FUNCTION__
|
|
|