diff options
author | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-04 03:19:38 +0000 |
---|---|---|
committer | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-04 03:19:38 +0000 |
commit | ffda1cb4c06b9744a7c276335063021f06f995f9 (patch) | |
tree | d2641cea984132f9855ead31980023c635027d0f /media | |
parent | fac9c5cc4ec399afe1fb2fc3f9c29734ade306dc (diff) | |
download | chromium_src-ffda1cb4c06b9744a7c276335063021f06f995f9.zip chromium_src-ffda1cb4c06b9744a7c276335063021f06f995f9.tar.gz chromium_src-ffda1cb4c06b9744a7c276335063021f06f995f9.tar.bz2 |
Only create AudioTimestampHelper when audio is present in MediaSourcePlayer.
Without this fix we hit a DCHECK in the ctor of AudioTimestampHelper that
bytes_per_frame > 0.
BUG=233420
TEST=none
Review URL: https://chromiumcodereview.appspot.com/18656003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210120 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/base/android/media_source_player.cc | 27 | ||||
-rw-r--r-- | media/base/android/media_source_player.h | 1 |
2 files changed, 19 insertions, 9 deletions
diff --git a/media/base/android/media_source_player.cc b/media/base/android/media_source_player.cc index 6a74188..c3380281 100644 --- a/media/base/android/media_source_player.cc +++ b/media/base/android/media_source_player.cc @@ -450,20 +450,29 @@ void MediaSourcePlayer::StartInternal() { void MediaSourcePlayer::DemuxerReady( const MediaPlayerHostMsg_DemuxerReady_Params& params) { duration_ = base::TimeDelta::FromMilliseconds(params.duration_ms); - width_ = params.video_size.width(); - height_ = params.video_size.height(); + clock_.SetDuration(duration_); + + audio_codec_ = params.audio_codec; num_channels_ = params.audio_channels; sampling_rate_ = params.audio_sampling_rate; - audio_codec_ = params.audio_codec; - video_codec_ = params.video_codec; - audio_extra_data_ = params.audio_extra_data; is_audio_encrypted_ = params.is_audio_encrypted; + audio_extra_data_ = params.audio_extra_data; + if (HasAudio()) { + DCHECK_GT(num_channels_, 0); + audio_timestamp_helper_.reset(new AudioTimestampHelper( + kBytesPerAudioOutputSample * num_channels_, sampling_rate_)); + audio_timestamp_helper_->SetBaseTimestamp(GetCurrentTime()); + } else { + audio_timestamp_helper_.reset(); + } + + video_codec_ = params.video_codec; + width_ = params.video_size.width(); + height_ = params.video_size.height(); is_video_encrypted_ = params.is_video_encrypted; - clock_.SetDuration(duration_); - audio_timestamp_helper_.reset(new AudioTimestampHelper( - kBytesPerAudioOutputSample * num_channels_, sampling_rate_)); - audio_timestamp_helper_->SetBaseTimestamp(GetCurrentTime()); + OnMediaMetadataChanged(duration_, width_, height_, true); + if (pending_event_ & CONFIG_CHANGE_EVENT_PENDING) { if (reconfig_audio_decoder_) ConfigureAudioDecoderJob(); diff --git a/media/base/android/media_source_player.h b/media/base/android/media_source_player.h index b3be398..3fe0e40 100644 --- a/media/base/android/media_source_player.h +++ b/media/base/android/media_source_player.h @@ -238,6 +238,7 @@ class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid { VideoCodec video_codec_; int num_channels_; int sampling_rate_; + // TODO(xhwang/qinmin): Add |video_extra_data_|. std::vector<uint8> audio_extra_data_; bool audio_finished_; bool video_finished_; |