Chromium Code Reviews| Index: content/renderer/media/android/media_source_delegate.cc |
| diff --git a/content/renderer/media/android/media_source_delegate.cc b/content/renderer/media/android/media_source_delegate.cc |
| index 324ee80b47a1b2f74b8072c73b02e4833d602846..7b9214b74c0ec2ade1c640355e68b0b32e363511 100644 |
| --- a/content/renderer/media/android/media_source_delegate.cc |
| +++ b/content/renderer/media/android/media_source_delegate.cc |
| @@ -390,14 +390,11 @@ void MediaSourceDelegate::OnBufferReady( |
| break; |
| case DemuxerStream::kConfigChanged: |
| - // In case of kConfigChanged, need to read decoder_config once |
| - // for the next reads. |
| - // TODO(kjyoun): Investigate if we need to use this new config. See |
| - // http://crbug.com/255783 |
| - if (is_audio) { |
| - audio_stream_->audio_decoder_config(); |
| - } else { |
| - gfx::Size size = video_stream_->video_decoder_config().coded_size(); |
| + CHECK((is_audio && audio_stream_) || (!is_audio && video_stream_)); |
| + data->demuxer_configs.resize(1); |
|
jschuh
2014/05/08 16:52:53
It looks like we could end up sending an empty con
qinmin
2014/05/08 17:20:04
Done.
|
| + GetDemuxerConfigFromStream(&data->demuxer_configs[0], is_audio); |
| + if (!is_audio) { |
| + gfx::Size size = data->demuxer_configs[0].video_size; |
| DVLOG(1) << "Video config is changed: " << size.width() << "x" |
| << size.height(); |
| } |
| @@ -641,13 +638,6 @@ void MediaSourceDelegate::DeleteSelf() { |
| delete this; |
| } |
| -void MediaSourceDelegate::OnMediaConfigRequest() { |
| - DCHECK(media_loop_->BelongsToCurrentThread()); |
| - DVLOG(1) << __FUNCTION__ << " : " << demuxer_client_id_; |
| - if (CanNotifyDemuxerReady()) |
| - NotifyDemuxerReady(); |
| -} |
| - |
| bool MediaSourceDelegate::CanNotifyDemuxerReady() { |
| DCHECK(media_loop_->BelongsToCurrentThread()); |
| return is_demuxer_ready_; |
| @@ -659,24 +649,8 @@ void MediaSourceDelegate::NotifyDemuxerReady() { |
| DCHECK(CanNotifyDemuxerReady()); |
| scoped_ptr<DemuxerConfigs> configs(new DemuxerConfigs()); |
| - if (audio_stream_) { |
| - media::AudioDecoderConfig config = audio_stream_->audio_decoder_config(); |
| - configs->audio_codec = config.codec(); |
| - configs->audio_channels = |
| - media::ChannelLayoutToChannelCount(config.channel_layout()); |
| - configs->audio_sampling_rate = config.samples_per_second(); |
| - configs->is_audio_encrypted = config.is_encrypted(); |
| - configs->audio_extra_data = std::vector<uint8>( |
| - config.extra_data(), config.extra_data() + config.extra_data_size()); |
| - } |
| - if (video_stream_) { |
| - media::VideoDecoderConfig config = video_stream_->video_decoder_config(); |
| - configs->video_codec = config.codec(); |
| - configs->video_size = config.natural_size(); |
| - configs->is_video_encrypted = config.is_encrypted(); |
| - configs->video_extra_data = std::vector<uint8>( |
| - config.extra_data(), config.extra_data() + config.extra_data_size()); |
| - } |
| + GetDemuxerConfigFromStream(configs.get(), true); |
| + GetDemuxerConfigFromStream(configs.get(), false); |
| configs->duration = GetDuration(); |
| if (demuxer_client_) |
| @@ -762,4 +736,30 @@ base::TimeDelta MediaSourceDelegate::FindBufferedBrowserSeekTime_Locked( |
| return seek_time; |
| } |
| +void MediaSourceDelegate::GetDemuxerConfigFromStream( |
| + media::DemuxerConfigs* configs, bool is_audio) { |
| + DCHECK(media_loop_->BelongsToCurrentThread()); |
| + if (!CanNotifyDemuxerReady()) |
| + return; |
| + if (is_audio && audio_stream_) { |
| + media::AudioDecoderConfig config = audio_stream_->audio_decoder_config(); |
| + configs->audio_codec = config.codec(); |
| + configs->audio_channels = |
| + media::ChannelLayoutToChannelCount(config.channel_layout()); |
| + configs->audio_sampling_rate = config.samples_per_second(); |
| + configs->is_audio_encrypted = config.is_encrypted(); |
| + configs->audio_extra_data = std::vector<uint8>( |
| + config.extra_data(), config.extra_data() + config.extra_data_size()); |
| + return; |
| + } |
| + if (!is_audio && video_stream_) { |
| + media::VideoDecoderConfig config = video_stream_->video_decoder_config(); |
| + configs->video_codec = config.codec(); |
| + configs->video_size = config.natural_size(); |
| + configs->is_video_encrypted = config.is_encrypted(); |
| + configs->video_extra_data = std::vector<uint8>( |
| + config.extra_data(), config.extra_data() + config.extra_data_size()); |
| + } |
| +} |
| + |
| } // namespace content |