Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(466)

Unified Diff: content/renderer/media/android/media_source_delegate.cc

Issue 257323003: Remove the IPC to request DemuxerConfigs when config changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..3291c4dffaea781d4640b1aae04431a349b0a287 100644
--- a/content/renderer/media/android/media_source_delegate.cc
+++ b/content/renderer/media/android/media_source_delegate.cc
@@ -390,14 +390,10 @@ 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();
+ data->demuxer_configs.resize(1);
+ GetDemuxerConfigFromStream(&data->demuxer_configs[0], is_audio);
wolenetz 2014/05/02 22:25:30 Previous code would null-reference crash if the re
qinmin 2014/05/05 20:52:19 Done.
+ 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 +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());
- }
+ GetDemuxerConfigFromStream(configs.get(), true);
+ GetDemuxerConfigFromStream(configs.get(), false);
configs->duration = GetDuration();
if (demuxer_client_)
@@ -762,4 +735,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

Powered by Google App Engine
This is Rietveld 408576698