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

Unified Diff: media/filters/media_source_state.cc

Issue 2170303002: Make MSE buffer sizes configurable via command line (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR feedback Created 4 years, 5 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
« media/base/media_switches.cc ('K') | « media/base/media_switches.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« media/base/media_switches.cc ('K') | « media/base/media_switches.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698