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

Side by Side 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: 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 unified diff | Download patch
« media/base/media_switches.h ('K') | « media/base/media_switches.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/filters/media_source_state.h" 5 #include "media/filters/media_source_state.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/command_line.h"
8 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string_number_conversions.h"
11 #include "media/base/media_switches.h"
9 #include "media/base/media_track.h" 12 #include "media/base/media_track.h"
10 #include "media/base/media_tracks.h" 13 #include "media/base/media_tracks.h"
11 #include "media/filters/chunk_demuxer.h" 14 #include "media/filters/chunk_demuxer.h"
12 #include "media/filters/frame_processor.h" 15 #include "media/filters/frame_processor.h"
13 #include "media/filters/source_buffer_stream.h" 16 #include "media/filters/source_buffer_stream.h"
14 17
15 namespace media { 18 namespace media {
16 19
17 enum { 20 enum {
18 // Limits the number of MEDIA_LOG() calls warning the user that a muxed stream 21 // Limits the number of MEDIA_LOG() calls warning the user that a muxed stream
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 } 577 }
575 578
576 if (!audio_) { 579 if (!audio_) {
577 audio_ = create_demuxer_stream_cb_.Run(DemuxerStream::AUDIO); 580 audio_ = create_demuxer_stream_cb_.Run(DemuxerStream::AUDIO);
578 581
579 if (!audio_) { 582 if (!audio_) {
580 DVLOG(1) << "Failed to create an audio stream."; 583 DVLOG(1) << "Failed to create an audio stream.";
581 return false; 584 return false;
582 } 585 }
583 586
587 std::string audioBufferSwitchStr =
wolenetz 2016/07/28 17:55:08 nit: I think the convention is to first check HasS
servolk 2016/07/28 21:46:46 This comment seems to imply that it's unnecessary:
wolenetz 2016/07/28 23:02:15 Acknowledged.
588 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
589 switches::kMSEAudioBufferSize);
590 unsigned mseAudioBufferSize = 0;
591 if (base::StringToUint(audioBufferSwitchStr, &mseAudioBufferSize) &&
592 mseAudioBufferSize > 0) {
593 audio_->SetStreamMemoryLimit(mseAudioBufferSize);
wolenetz 2016/07/28 17:55:08 nit: Please add a MEDIA_LOG either here, or perhap
servolk 2016/07/28 21:46:46 Done.
594 }
595
584 if (!frame_processor_->AddTrack(FrameProcessor::kAudioTrackId, audio_)) { 596 if (!frame_processor_->AddTrack(FrameProcessor::kAudioTrackId, audio_)) {
585 DVLOG(1) << "Failed to add audio track to frame processor."; 597 DVLOG(1) << "Failed to add audio track to frame processor.";
586 return false; 598 return false;
587 } 599 }
588 } 600 }
589 601
590 frame_processor_->OnPossibleAudioConfigUpdate(audio_config); 602 frame_processor_->OnPossibleAudioConfigUpdate(audio_config);
591 success &= audio_->UpdateAudioConfig(audio_config, media_log_); 603 success &= audio_->UpdateAudioConfig(audio_config, media_log_);
592 } 604 }
593 605
594 if (video_config.IsValidConfig()) { 606 if (video_config.IsValidConfig()) {
595 if (!video_) { 607 if (!video_) {
596 media_log_->SetBooleanProperty("found_video_stream", true); 608 media_log_->SetBooleanProperty("found_video_stream", true);
597 } 609 }
598 if (!video_ || 610 if (!video_ ||
599 video_->video_decoder_config().codec() != video_config.codec()) { 611 video_->video_decoder_config().codec() != video_config.codec()) {
600 media_log_->SetStringProperty("video_codec_name", 612 media_log_->SetStringProperty("video_codec_name",
601 GetCodecName(video_config.codec())); 613 GetCodecName(video_config.codec()));
602 } 614 }
603 615
604 if (!video_) { 616 if (!video_) {
605 video_ = create_demuxer_stream_cb_.Run(DemuxerStream::VIDEO); 617 video_ = create_demuxer_stream_cb_.Run(DemuxerStream::VIDEO);
606 618
607 if (!video_) { 619 if (!video_) {
608 DVLOG(1) << "Failed to create a video stream."; 620 DVLOG(1) << "Failed to create a video stream.";
609 return false; 621 return false;
610 } 622 }
611 623
624 std::string videoBufferSwitchStr =
625 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
626 switches::kMSEVideoBufferSize);
627 unsigned mseVideoBufferSize = 0;
628 if (base::StringToUint(videoBufferSwitchStr, &mseVideoBufferSize) &&
629 mseVideoBufferSize > 0) {
630 video_->SetStreamMemoryLimit(mseVideoBufferSize);
631 }
632
612 if (!frame_processor_->AddTrack(FrameProcessor::kVideoTrackId, video_)) { 633 if (!frame_processor_->AddTrack(FrameProcessor::kVideoTrackId, video_)) {
613 DVLOG(1) << "Failed to add video track to frame processor."; 634 DVLOG(1) << "Failed to add video track to frame processor.";
614 return false; 635 return false;
615 } 636 }
616 } 637 }
617 638
618 success &= video_->UpdateVideoConfig(video_config, media_log_); 639 success &= video_->UpdateVideoConfig(video_config, media_log_);
619 } 640 }
620 641
621 typedef StreamParser::TextTrackConfigMap::const_iterator TextConfigItr; 642 typedef StreamParser::TextTrackConfigMap::const_iterator TextConfigItr;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 813
793 void MediaSourceState::OnSourceInitDone( 814 void MediaSourceState::OnSourceInitDone(
794 const StreamParser::InitParameters& params) { 815 const StreamParser::InitParameters& params) {
795 DCHECK_EQ(state_, PENDING_PARSER_INIT); 816 DCHECK_EQ(state_, PENDING_PARSER_INIT);
796 state_ = PARSER_INITIALIZED; 817 state_ = PARSER_INITIALIZED;
797 auto_update_timestamp_offset_ = params.auto_update_timestamp_offset; 818 auto_update_timestamp_offset_ = params.auto_update_timestamp_offset;
798 base::ResetAndReturn(&init_cb_).Run(params); 819 base::ResetAndReturn(&init_cb_).Run(params);
799 } 820 }
800 821
801 } // namespace media 822 } // namespace media
OLDNEW
« media/base/media_switches.h ('K') | « media/base/media_switches.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698