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..4ea5c365b5eb156952b4d38959e79fbd1ae3e02d 100644 |
| --- a/content/renderer/media/android/media_source_delegate.cc |
| +++ b/content/renderer/media/android/media_source_delegate.cc |
| @@ -390,17 +390,13 @@ 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 { |
| + if (!is_audio) { |
| gfx::Size size = video_stream_->video_decoder_config().coded_size(); |
|
wolenetz
2014/04/25 23:13:13
nit: Do we need to report coded_size() here? Or is
qinmin
2014/04/26 01:30:11
Done. we should simply using natural_size.
On 2014
|
| DVLOG(1) << "Video config is changed: " << size.width() << "x" |
| << size.height(); |
| } |
| + data->demuxer_configs.resize(1); |
| + GetDeumuxerConfigFromStream(&data->demuxer_configs[0], is_audio); |
|
wolenetz
2014/04/25 23:13:13
nit: ditto (spelling), here and below.
qinmin
2014/04/26 01:30:11
Done.
|
| data->access_units[index].status = status; |
| data->access_units.resize(index + 1); |
| break; |
| @@ -641,13 +637,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 +648,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()); |
| - } |
| + GetDeumuxerConfigFromStream(configs.get(), true); |
| + GetDeumuxerConfigFromStream(configs.get(), false); |
| configs->duration = GetDuration(); |
| if (demuxer_client_) |
| @@ -762,4 +735,28 @@ base::TimeDelta MediaSourceDelegate::FindBufferedBrowserSeekTime_Locked( |
| return seek_time; |
| } |
| +void MediaSourceDelegate::GetDeumuxerConfigFromStream( |
| + media::DemuxerConfigs* configs, bool is_audio) { |
| + DCHECK(media_loop_->BelongsToCurrentThread()); |
| + 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 |