OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 // We have already printed the codec map. Just end the program. | 392 // We have already printed the codec map. Just end the program. |
393 return 0; | 393 return 0; |
394 } | 394 } |
395 // Print usage information. | 395 // Print usage information. |
396 std::cout << google::ProgramUsage(); | 396 std::cout << google::ProgramUsage(); |
397 return 0; | 397 return 0; |
398 } | 398 } |
399 | 399 |
400 printf("Input file: %s\n", argv[1]); | 400 printf("Input file: %s\n", argv[1]); |
401 | 401 |
402 // TODO(ivoc): Modify the RtpFileSource::Create and RtcEventLogSource::Create | |
403 // functions to return a nullptr on failure instead of crashing | |
404 // the program. | |
405 | |
406 // This temporary solution uses a RtpFileReader directly to check if the file | |
407 // is a valid RtpDump file. | |
408 bool is_rtp_dump = false; | 402 bool is_rtp_dump = false; |
409 { | |
410 rtc::scoped_ptr<webrtc::test::RtpFileReader> rtp_reader( | |
411 webrtc::test::RtpFileReader::Create( | |
412 webrtc::test::RtpFileReader::kRtpDump, argv[1])); | |
413 if (rtp_reader) | |
414 is_rtp_dump = true; | |
415 } | |
416 rtc::scoped_ptr<webrtc::test::PacketSource> file_source; | 403 rtc::scoped_ptr<webrtc::test::PacketSource> file_source; |
417 webrtc::test::RtcEventLogSource* event_log_source = nullptr; | 404 webrtc::test::RtcEventLogSource* event_log_source = nullptr; |
418 if (is_rtp_dump) { | 405 if (webrtc::test::RtpFileSource::ValidRtpDump(argv[1]) || |
| 406 webrtc::test::RtpFileSource::ValidPcap(argv[1])) { |
| 407 is_rtp_dump = true; |
419 file_source.reset(webrtc::test::RtpFileSource::Create(argv[1])); | 408 file_source.reset(webrtc::test::RtpFileSource::Create(argv[1])); |
420 } else { | 409 } else { |
421 event_log_source = webrtc::test::RtcEventLogSource::Create(argv[1]); | 410 event_log_source = webrtc::test::RtcEventLogSource::Create(argv[1]); |
422 file_source.reset(event_log_source); | 411 file_source.reset(event_log_source); |
423 } | 412 } |
424 | 413 |
425 assert(file_source.get()); | 414 assert(file_source.get()); |
426 | 415 |
427 // Check if an SSRC value was provided. | 416 // Check if an SSRC value was provided. |
428 if (!FLAGS_ssrc.empty()) { | 417 if (!FLAGS_ssrc.empty()) { |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 } | 631 } |
643 } | 632 } |
644 printf("Simulation done\n"); | 633 printf("Simulation done\n"); |
645 printf("Produced %i ms of audio\n", | 634 printf("Produced %i ms of audio\n", |
646 static_cast<int>(time_now_ms - start_time_ms)); | 635 static_cast<int>(time_now_ms - start_time_ms)); |
647 | 636 |
648 delete neteq; | 637 delete neteq; |
649 webrtc::Trace::ReturnTrace(); | 638 webrtc::Trace::ReturnTrace(); |
650 return 0; | 639 return 0; |
651 } | 640 } |
OLD | NEW |