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

Side by Side Diff: media/cast/test/simulator.cc

Issue 819203002: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 12 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
« no previous file with comments | « media/cast/test/sender.cc ('k') | media/cast/test/utility/input_builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // Simulate end to end streaming. 5 // Simulate end to end streaming.
6 // 6 //
7 // Input: 7 // Input:
8 // --source= 8 // --source=
9 // WebM used as the source of video and audio frames. 9 // WebM used as the source of video and audio frames.
10 // --output= 10 // --output=
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 const char kNoSimulation[] = "no-simulation"; 93 const char kNoSimulation[] = "no-simulation";
94 const char kRunTime[] = "run-time"; 94 const char kRunTime[] = "run-time";
95 const char kSimulationId[] = "sim-id"; 95 const char kSimulationId[] = "sim-id";
96 const char kSourcePath[] = "source"; 96 const char kSourcePath[] = "source";
97 const char kSourceFrameRate[] = "source-frame-rate"; 97 const char kSourceFrameRate[] = "source-frame-rate";
98 const char kTargetDelay[] = "target-delay-ms"; 98 const char kTargetDelay[] = "target-delay-ms";
99 const char kYuvOutputPath[] = "yuv-output"; 99 const char kYuvOutputPath[] = "yuv-output";
100 100
101 int GetIntegerSwitchValue(const char* switch_name, int default_value) { 101 int GetIntegerSwitchValue(const char* switch_name, int default_value) {
102 const std::string as_str = 102 const std::string as_str =
103 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switch_name); 103 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switch_name);
104 if (as_str.empty()) 104 if (as_str.empty())
105 return default_value; 105 return default_value;
106 int as_int; 106 int as_int;
107 CHECK(base::StringToInt(as_str, &as_int)); 107 CHECK(base::StringToInt(as_str, &as_int));
108 CHECK_GT(as_int, 0); 108 CHECK_GT(as_int, 0);
109 return as_int; 109 return as_int;
110 } 110 }
111 111
112 void UpdateCastTransportStatus(CastTransportStatus status) { 112 void UpdateCastTransportStatus(CastTransportStatus status) {
113 LOG(INFO) << "Cast transport status: " << status; 113 LOG(INFO) << "Cast transport status: " << status;
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 for (int i = 0; i < ipp.average_rate_size(); i++) { 685 for (int i = 0; i < ipp.average_rate_size(); i++) {
686 if (ipp.average_rate(i) <= 0.0) 686 if (ipp.average_rate(i) <= 0.0)
687 return false; 687 return false;
688 } 688 }
689 } 689 }
690 690
691 return true; 691 return true;
692 } 692 }
693 693
694 NetworkSimulationModel LoadModel(const base::FilePath& model_path) { 694 NetworkSimulationModel LoadModel(const base::FilePath& model_path) {
695 if (CommandLine::ForCurrentProcess()->HasSwitch(kNoSimulation)) { 695 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kNoSimulation)) {
696 NetworkSimulationModel model; 696 NetworkSimulationModel model;
697 model.set_type(media::cast::proto::NO_SIMULATION); 697 model.set_type(media::cast::proto::NO_SIMULATION);
698 return model; 698 return model;
699 } 699 }
700 if (model_path.empty()) { 700 if (model_path.empty()) {
701 LOG(ERROR) << "Model path not set; Using default model."; 701 LOG(ERROR) << "Model path not set; Using default model.";
702 return DefaultModel(); 702 return DefaultModel();
703 } 703 }
704 std::string model_str; 704 std::string model_str;
705 if (!base::ReadFileToString(model_path, &model_str)) { 705 if (!base::ReadFileToString(model_path, &model_str)) {
(...skipping 13 matching lines...) Expand all
719 719
720 return model; 720 return model;
721 } 721 }
722 722
723 } // namespace 723 } // namespace
724 } // namespace cast 724 } // namespace cast
725 } // namespace media 725 } // namespace media
726 726
727 int main(int argc, char** argv) { 727 int main(int argc, char** argv) {
728 base::AtExitManager at_exit; 728 base::AtExitManager at_exit;
729 CommandLine::Init(argc, argv); 729 base::CommandLine::Init(argc, argv);
730 InitLogging(logging::LoggingSettings()); 730 InitLogging(logging::LoggingSettings());
731 731
732 const CommandLine* cmd = CommandLine::ForCurrentProcess(); 732 const base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
733 base::FilePath media_path = cmd->GetSwitchValuePath(media::cast::kLibDir); 733 base::FilePath media_path = cmd->GetSwitchValuePath(media::cast::kLibDir);
734 if (media_path.empty()) { 734 if (media_path.empty()) {
735 if (!PathService::Get(base::DIR_MODULE, &media_path)) { 735 if (!PathService::Get(base::DIR_MODULE, &media_path)) {
736 LOG(ERROR) << "Failed to load FFmpeg."; 736 LOG(ERROR) << "Failed to load FFmpeg.";
737 return 1; 737 return 1;
738 } 738 }
739 } 739 }
740 740
741 if (!media::InitializeMediaLibrary(media_path)) { 741 if (!media::InitializeMediaLibrary(media_path)) {
742 LOG(ERROR) << "Failed to initialize FFmpeg."; 742 LOG(ERROR) << "Failed to initialize FFmpeg.";
(...skipping 22 matching lines...) Expand all
765 values.SetString("sim-id", sim_id); 765 values.SetString("sim-id", sim_id);
766 766
767 std::string extra_data; 767 std::string extra_data;
768 base::JSONWriter::Write(&values, &extra_data); 768 base::JSONWriter::Write(&values, &extra_data);
769 769
770 // Run. 770 // Run.
771 media::cast::RunSimulation(source_path, log_output_path, metrics_output_path, 771 media::cast::RunSimulation(source_path, log_output_path, metrics_output_path,
772 yuv_output_path, extra_data, model); 772 yuv_output_path, extra_data, model);
773 return 0; 773 return 0;
774 } 774 }
OLDNEW
« no previous file with comments | « media/cast/test/sender.cc ('k') | media/cast/test/utility/input_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698