| 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 std::cout << "Output file: " << argv[2] << std::endl; | 468 std::cout << "Output file: " << argv[2] << std::endl; |
| 468 | 469 |
| 469 // Enable tracing. | 470 // Enable tracing. |
| 470 Trace::CreateTrace(); | 471 Trace::CreateTrace(); |
| 471 Trace::SetTraceFile((OutputPath() + "neteq_trace.txt").c_str()); | 472 Trace::SetTraceFile((OutputPath() + "neteq_trace.txt").c_str()); |
| 472 Trace::set_level_filter(kTraceAll); | 473 Trace::set_level_filter(kTraceAll); |
| 473 | 474 |
| 474 // Initialize NetEq instance. | 475 // Initialize NetEq instance. |
| 475 NetEq::Config config; | 476 NetEq::Config config; |
| 476 config.sample_rate_hz = sample_rate_hz; | 477 config.sample_rate_hz = sample_rate_hz; |
| 477 NetEq* neteq = NetEq::Create(config); | 478 NetEq* neteq = |
| 479 NetEq::Create(config, CreateBuiltinAudioDecoderFactory()); |
| 478 RegisterPayloadTypes(neteq); | 480 RegisterPayloadTypes(neteq); |
| 479 | 481 |
| 480 | 482 |
| 481 // Set up variables for audio replacement if needed. | 483 // Set up variables for audio replacement if needed. |
| 482 std::unique_ptr<Packet> next_packet; | 484 std::unique_ptr<Packet> next_packet; |
| 483 bool next_packet_available = false; | 485 bool next_packet_available = false; |
| 484 size_t input_frame_size_timestamps = 0; | 486 size_t input_frame_size_timestamps = 0; |
| 485 std::unique_ptr<int16_t[]> replacement_audio; | 487 std::unique_ptr<int16_t[]> replacement_audio; |
| 486 std::unique_ptr<uint8_t[]> payload; | 488 std::unique_ptr<uint8_t[]> payload; |
| 487 size_t payload_mem_size_bytes = 0; | 489 size_t payload_mem_size_bytes = 0; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 printf("Produced %i ms of audio\n", | 626 printf("Produced %i ms of audio\n", |
| 625 static_cast<int>(time_now_ms - start_time_ms)); | 627 static_cast<int>(time_now_ms - start_time_ms)); |
| 626 | 628 |
| 627 delete neteq; | 629 delete neteq; |
| 628 Trace::ReturnTrace(); | 630 Trace::ReturnTrace(); |
| 629 return 0; | 631 return 0; |
| 630 } | 632 } |
| 631 | 633 |
| 632 } // namespace test | 634 } // namespace test |
| 633 } // namespace webrtc | 635 } // namespace webrtc |
| OLD | NEW |