Chromium Code Reviews| Index: media/filters/media_source_state.cc |
| diff --git a/media/filters/media_source_state.cc b/media/filters/media_source_state.cc |
| index 154ce167bc4bd31272880dfb4bba528d236d4fdc..3f8d448d9e3232d24d13ee7c98022d1673a8a22e 100644 |
| --- a/media/filters/media_source_state.cc |
| +++ b/media/filters/media_source_state.cc |
| @@ -5,7 +5,10 @@ |
| #include "media/filters/media_source_state.h" |
| #include "base/callback_helpers.h" |
| +#include "base/command_line.h" |
| #include "base/stl_util.h" |
| +#include "base/strings/string_number_conversions.h" |
| +#include "media/base/media_switches.h" |
| #include "media/base/media_track.h" |
| #include "media/base/media_tracks.h" |
| #include "media/filters/chunk_demuxer.h" |
| @@ -573,6 +576,7 @@ bool MediaSourceState::OnNewConfigs( |
| GetCodecName(audio_config.codec())); |
| } |
| + bool audio_stream_just_created = false; |
| if (!audio_) { |
| audio_ = create_demuxer_stream_cb_.Run(DemuxerStream::AUDIO); |
| @@ -580,6 +584,7 @@ bool MediaSourceState::OnNewConfigs( |
| DVLOG(1) << "Failed to create an audio stream."; |
| return false; |
| } |
| + audio_stream_just_created = true; |
| if (!frame_processor_->AddTrack(FrameProcessor::kAudioTrackId, audio_)) { |
| DVLOG(1) << "Failed to add audio track to frame processor."; |
| @@ -589,6 +594,19 @@ bool MediaSourceState::OnNewConfigs( |
| frame_processor_->OnPossibleAudioConfigUpdate(audio_config); |
| success &= audio_->UpdateAudioConfig(audio_config, media_log_); |
| + |
| + if (audio_stream_just_created) { |
|
alokp
2016/07/29 21:36:21
can you just move this into "if (!audio_)" block a
servolk
2016/07/29 22:14:10
I tried that (see earlier patchsets), but this nee
alokp
2016/07/30 00:08:26
OK. Although I would prefer the buffer size limits
|
| + std::string audioBufferSwitchStr = |
|
alokp
2016/07/29 21:36:21
variable names do not follow chromium style guide.
servolk
2016/07/29 22:14:10
Done.
|
| + base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| + switches::kMSEAudioBufferSizeLimit); |
| + unsigned mseAudioBufferSizeLimit = 0; |
|
alokp
2016/07/29 21:36:21
variable name
servolk
2016/07/29 22:14:10
Done.
|
| + if (base::StringToUint(audioBufferSwitchStr, &mseAudioBufferSizeLimit) && |
| + mseAudioBufferSizeLimit > 0) { |
| + MEDIA_LOG(INFO, media_log_) << "Custom MSE audio SourceBuffer size=" |
| + << mseAudioBufferSizeLimit; |
| + audio_->SetStreamMemoryLimit(mseAudioBufferSizeLimit); |
| + } |
| + } |
| } |
| if (video_config.IsValidConfig()) { |
| @@ -601,6 +619,7 @@ bool MediaSourceState::OnNewConfigs( |
| GetCodecName(video_config.codec())); |
| } |
| + bool video_stream_just_created = false; |
|
alokp
2016/07/29 21:36:21
ditto
servolk
2016/07/29 22:14:10
Done.
|
| if (!video_) { |
| video_ = create_demuxer_stream_cb_.Run(DemuxerStream::VIDEO); |
| @@ -608,6 +627,7 @@ bool MediaSourceState::OnNewConfigs( |
| DVLOG(1) << "Failed to create a video stream."; |
| return false; |
| } |
| + video_stream_just_created = true; |
| if (!frame_processor_->AddTrack(FrameProcessor::kVideoTrackId, video_)) { |
| DVLOG(1) << "Failed to add video track to frame processor."; |
| @@ -616,6 +636,19 @@ bool MediaSourceState::OnNewConfigs( |
| } |
| success &= video_->UpdateVideoConfig(video_config, media_log_); |
| + |
| + if (video_stream_just_created) { |
| + std::string videoBufferSwitchStr = |
| + base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| + switches::kMSEVideoBufferSizeLimit); |
| + unsigned mseVideoBufferSizeLimit = 0; |
| + if (base::StringToUint(videoBufferSwitchStr, &mseVideoBufferSizeLimit) && |
| + mseVideoBufferSizeLimit > 0) { |
| + MEDIA_LOG(INFO, media_log_) << "Custom MSE video SourceBuffer size=" |
| + << mseVideoBufferSizeLimit; |
| + video_->SetStreamMemoryLimit(mseVideoBufferSizeLimit); |
| + } |
| + } |
| } |
| typedef StreamParser::TextTrackConfigMap::const_iterator TextConfigItr; |