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

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: Adjusted variable and switch names 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
« no previous file with comments | « 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..3486f985e825718d201506a18774f085e22c4573 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) {
+ std::string audio_buf_limit_switch =
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kMSEAudioBufferSizeLimit);
+ unsigned audio_buf_size_limit = 0;
+ if (base::StringToUint(audio_buf_limit_switch, &audio_buf_size_limit) &&
+ audio_buf_size_limit > 0) {
+ MEDIA_LOG(INFO, media_log_) << "Custom audio SourceBuffer size limit="
+ << audio_buf_size_limit;
+ audio_->SetStreamMemoryLimit(audio_buf_size_limit);
+ }
+ }
}
if (video_config.IsValidConfig()) {
@@ -601,6 +619,7 @@ bool MediaSourceState::OnNewConfigs(
GetCodecName(video_config.codec()));
}
+ bool video_stream_just_created = false;
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 video_buf_limit_switch =
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kMSEVideoBufferSizeLimit);
+ unsigned video_buf_size_limit = 0;
+ if (base::StringToUint(video_buf_limit_switch, &video_buf_size_limit) &&
+ video_buf_size_limit > 0) {
+ MEDIA_LOG(INFO, media_log_) << "Custom video SourceBuffer size limit="
+ << video_buf_size_limit;
+ video_->SetStreamMemoryLimit(video_buf_size_limit);
+ }
+ }
}
typedef StreamParser::TextTrackConfigMap::const_iterator TextConfigItr;
« no previous file with comments | « media/base/media_switches.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698