OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // Test application that simulates a cast sender - Data can be either generated | 5 // Test application that simulates a cast sender - Data can be either generated |
6 // or read from a file. | 6 // or read from a file. |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 json.clear(); | 242 json.clear(); |
243 base::JSONWriter::WriteWithOptions( | 243 base::JSONWriter::WriteWithOptions( |
244 stats.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &json); | 244 stats.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &json); |
245 VLOG(0) << "Audio stats: " << json; | 245 VLOG(0) << "Audio stats: " << json; |
246 } | 246 } |
247 | 247 |
248 } // namespace | 248 } // namespace |
249 | 249 |
250 int main(int argc, char** argv) { | 250 int main(int argc, char** argv) { |
251 base::AtExitManager at_exit; | 251 base::AtExitManager at_exit; |
252 CommandLine::Init(argc, argv); | 252 base::CommandLine::Init(argc, argv); |
253 InitLogging(logging::LoggingSettings()); | 253 InitLogging(logging::LoggingSettings()); |
254 | 254 |
255 // Load the media module for FFmpeg decoding. | 255 // Load the media module for FFmpeg decoding. |
256 base::FilePath path; | 256 base::FilePath path; |
257 PathService::Get(base::DIR_MODULE, &path); | 257 PathService::Get(base::DIR_MODULE, &path); |
258 if (!media::InitializeMediaLibrary(path)) { | 258 if (!media::InitializeMediaLibrary(path)) { |
259 LOG(ERROR) << "Could not initialize media library."; | 259 LOG(ERROR) << "Could not initialize media library."; |
260 return 1; | 260 return 1; |
261 } | 261 } |
262 | 262 |
263 base::Thread test_thread("Cast sender test app thread"); | 263 base::Thread test_thread("Cast sender test app thread"); |
264 base::Thread audio_thread("Cast audio encoder thread"); | 264 base::Thread audio_thread("Cast audio encoder thread"); |
265 base::Thread video_thread("Cast video encoder thread"); | 265 base::Thread video_thread("Cast video encoder thread"); |
266 test_thread.Start(); | 266 test_thread.Start(); |
267 audio_thread.Start(); | 267 audio_thread.Start(); |
268 video_thread.Start(); | 268 video_thread.Start(); |
269 | 269 |
270 base::MessageLoopForIO io_message_loop; | 270 base::MessageLoopForIO io_message_loop; |
271 | 271 |
272 // Default parameters. | 272 // Default parameters. |
273 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 273 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
274 std::string remote_ip_address = cmd->GetSwitchValueASCII(kSwitchAddress); | 274 std::string remote_ip_address = cmd->GetSwitchValueASCII(kSwitchAddress); |
275 if (remote_ip_address.empty()) | 275 if (remote_ip_address.empty()) |
276 remote_ip_address = "127.0.0.1"; | 276 remote_ip_address = "127.0.0.1"; |
277 int remote_port = 0; | 277 int remote_port = 0; |
278 if (!base::StringToInt(cmd->GetSwitchValueASCII(kSwitchPort), &remote_port) || | 278 if (!base::StringToInt(cmd->GetSwitchValueASCII(kSwitchPort), &remote_port) || |
279 remote_port < 0 || remote_port > 65535) { | 279 remote_port < 0 || remote_port > 65535) { |
280 remote_port = 2344; | 280 remote_port = 2344; |
281 } | 281 } |
282 LOG(INFO) << "Sending to " << remote_ip_address << ":" << remote_port | 282 LOG(INFO) << "Sending to " << remote_ip_address << ":" << remote_port |
283 << "."; | 283 << "."; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 base::Passed(&audio_stats_subscriber), | 404 base::Passed(&audio_stats_subscriber), |
405 base::Passed(&offset_estimator)), | 405 base::Passed(&offset_estimator)), |
406 base::TimeDelta::FromSeconds(logging_duration_seconds)); | 406 base::TimeDelta::FromSeconds(logging_duration_seconds)); |
407 | 407 |
408 fake_media_source->Start(cast_sender->audio_frame_input(), | 408 fake_media_source->Start(cast_sender->audio_frame_input(), |
409 cast_sender->video_frame_input()); | 409 cast_sender->video_frame_input()); |
410 | 410 |
411 io_message_loop.Run(); | 411 io_message_loop.Run(); |
412 return 0; | 412 return 0; |
413 } | 413 } |
OLD | NEW |