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 |
11 // TODO(hlundin): The functionality in this file should be moved into one or | 11 // TODO(hlundin): The functionality in this file should be moved into one or |
12 // several classes. | 12 // several classes. |
13 | 13 |
14 #include <assert.h> | 14 #include <assert.h> |
15 #include <errno.h> | 15 #include <errno.h> |
16 #include <limits.h> // For ULONG_MAX returned by strtoul. | 16 #include <limits.h> // For ULONG_MAX returned by strtoul. |
17 #include <stdio.h> | 17 #include <stdio.h> |
18 #include <stdlib.h> // For strtoul. | 18 #include <stdlib.h> // For strtoul. |
19 | 19 |
20 #include <algorithm> | 20 #include <algorithm> |
21 #include <iostream> | 21 #include <iostream> |
22 #include <memory> | 22 #include <memory> |
23 #include <limits> | 23 #include <limits> |
24 #include <string> | 24 #include <string> |
25 | 25 |
26 #include "gflags/gflags.h" | 26 #include "gflags/gflags.h" |
27 #include "webrtc/base/checks.h" | 27 #include "webrtc/base/checks.h" |
28 #include "webrtc/base/safe_conversions.h" | 28 #include "webrtc/base/safe_conversions.h" |
| 29 #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h" |
29 #include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h" | 30 #include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h" |
30 #include "webrtc/modules/audio_coding/neteq/include/neteq.h" | 31 #include "webrtc/modules/audio_coding/neteq/include/neteq.h" |
31 #include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h" | 32 #include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h" |
32 #include "webrtc/modules/audio_coding/neteq/tools/output_audio_file.h" | 33 #include "webrtc/modules/audio_coding/neteq/tools/output_audio_file.h" |
33 #include "webrtc/modules/audio_coding/neteq/tools/output_wav_file.h" | 34 #include "webrtc/modules/audio_coding/neteq/tools/output_wav_file.h" |
34 #include "webrtc/modules/audio_coding/neteq/tools/packet.h" | 35 #include "webrtc/modules/audio_coding/neteq/tools/packet.h" |
35 #include "webrtc/modules/audio_coding/neteq/tools/rtc_event_log_source.h" | 36 #include "webrtc/modules/audio_coding/neteq/tools/rtc_event_log_source.h" |
36 #include "webrtc/modules/audio_coding/neteq/tools/rtp_file_source.h" | 37 #include "webrtc/modules/audio_coding/neteq/tools/rtp_file_source.h" |
37 #include "webrtc/modules/include/module_common_types.h" | 38 #include "webrtc/modules/include/module_common_types.h" |
38 #include "webrtc/system_wrappers/include/trace.h" | 39 #include "webrtc/system_wrappers/include/trace.h" |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 | 482 |
482 // Enable tracing. | 483 // Enable tracing. |
483 webrtc::Trace::CreateTrace(); | 484 webrtc::Trace::CreateTrace(); |
484 webrtc::Trace::SetTraceFile((webrtc::test::OutputPath() + | 485 webrtc::Trace::SetTraceFile((webrtc::test::OutputPath() + |
485 "neteq_trace.txt").c_str()); | 486 "neteq_trace.txt").c_str()); |
486 webrtc::Trace::set_level_filter(webrtc::kTraceAll); | 487 webrtc::Trace::set_level_filter(webrtc::kTraceAll); |
487 | 488 |
488 // Initialize NetEq instance. | 489 // Initialize NetEq instance. |
489 NetEq::Config config; | 490 NetEq::Config config; |
490 config.sample_rate_hz = sample_rate_hz; | 491 config.sample_rate_hz = sample_rate_hz; |
491 NetEq* neteq = NetEq::Create(config); | 492 NetEq* neteq = |
| 493 NetEq::Create(config, webrtc::CreateBuiltinAudioDecoderFactory()); |
492 RegisterPayloadTypes(neteq); | 494 RegisterPayloadTypes(neteq); |
493 | 495 |
494 | 496 |
495 // Set up variables for audio replacement if needed. | 497 // Set up variables for audio replacement if needed. |
496 std::unique_ptr<webrtc::test::Packet> next_packet; | 498 std::unique_ptr<webrtc::test::Packet> next_packet; |
497 bool next_packet_available = false; | 499 bool next_packet_available = false; |
498 size_t input_frame_size_timestamps = 0; | 500 size_t input_frame_size_timestamps = 0; |
499 std::unique_ptr<int16_t[]> replacement_audio; | 501 std::unique_ptr<int16_t[]> replacement_audio; |
500 std::unique_ptr<uint8_t[]> payload; | 502 std::unique_ptr<uint8_t[]> payload; |
501 size_t payload_mem_size_bytes = 0; | 503 size_t payload_mem_size_bytes = 0; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 } | 635 } |
634 } | 636 } |
635 printf("Simulation done\n"); | 637 printf("Simulation done\n"); |
636 printf("Produced %i ms of audio\n", | 638 printf("Produced %i ms of audio\n", |
637 static_cast<int>(time_now_ms - start_time_ms)); | 639 static_cast<int>(time_now_ms - start_time_ms)); |
638 | 640 |
639 delete neteq; | 641 delete neteq; |
640 webrtc::Trace::ReturnTrace(); | 642 webrtc::Trace::ReturnTrace(); |
641 return 0; | 643 return 0; |
642 } | 644 } |
OLD | NEW |