OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 #ifndef WEBRTC_MODULES_AUDIO_CODING_ACM2_ACM_RECEIVE_TEST_OLDAPI_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_ACM2_ACM_RECEIVE_TEST_OLDAPI_H_ |
12 #define WEBRTC_MODULES_AUDIO_CODING_ACM2_ACM_RECEIVE_TEST_OLDAPI_H_ | 12 #define WEBRTC_MODULES_AUDIO_CODING_ACM2_ACM_RECEIVE_TEST_OLDAPI_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 #include <string> | 15 #include <string> |
16 | 16 |
17 #include "webrtc/base/constructormagic.h" | 17 #include "webrtc/base/constructormagic.h" |
| 18 #include "webrtc/base/scoped_ref_ptr.h" |
| 19 #include "webrtc/modules/audio_coding/codecs/audio_decoder_factory.h" |
18 #include "webrtc/system_wrappers/include/clock.h" | 20 #include "webrtc/system_wrappers/include/clock.h" |
19 | 21 |
20 namespace webrtc { | 22 namespace webrtc { |
21 class AudioCodingModule; | 23 class AudioCodingModule; |
22 class AudioDecoder; | 24 class AudioDecoder; |
23 struct CodecInst; | 25 struct CodecInst; |
24 | 26 |
25 namespace test { | 27 namespace test { |
26 class AudioSink; | 28 class AudioSink; |
27 class PacketSource; | 29 class PacketSource; |
28 | 30 |
29 class AcmReceiveTestOldApi { | 31 class AcmReceiveTestOldApi { |
30 public: | 32 public: |
31 enum NumOutputChannels { | 33 enum NumOutputChannels { |
32 kArbitraryChannels = 0, | 34 kArbitraryChannels = 0, |
33 kMonoOutput = 1, | 35 kMonoOutput = 1, |
34 kStereoOutput = 2 | 36 kStereoOutput = 2 |
35 }; | 37 }; |
36 | 38 |
37 AcmReceiveTestOldApi(PacketSource* packet_source, | 39 AcmReceiveTestOldApi(PacketSource* packet_source, |
38 AudioSink* audio_sink, | 40 AudioSink* audio_sink, |
39 int output_freq_hz, | 41 int output_freq_hz, |
40 NumOutputChannels exptected_output_channels); | 42 NumOutputChannels exptected_output_channels, |
| 43 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory); |
41 virtual ~AcmReceiveTestOldApi(); | 44 virtual ~AcmReceiveTestOldApi(); |
42 | 45 |
43 // Registers the codecs with default parameters from ACM. | 46 // Registers the codecs with default parameters from ACM. |
44 void RegisterDefaultCodecs(); | 47 void RegisterDefaultCodecs(); |
45 | 48 |
46 // Registers codecs with payload types matching the pre-encoded NetEq test | 49 // Registers codecs with payload types matching the pre-encoded NetEq test |
47 // files. | 50 // files. |
48 void RegisterNetEqTestCodecs(); | 51 void RegisterNetEqTestCodecs(); |
49 | 52 |
50 int RegisterExternalReceiveCodec(int rtp_payload_type, | 53 int RegisterExternalReceiveCodec(int rtp_payload_type, |
51 AudioDecoder* external_decoder, | 54 AudioDecoder* external_decoder, |
52 int sample_rate_hz, | 55 int sample_rate_hz, |
53 int num_channels, | 56 int num_channels, |
54 const std::string& name); | 57 const std::string& name); |
55 | 58 |
56 // Runs the test and returns true if successful. | 59 // Runs the test and returns true if successful. |
57 void Run(); | 60 void Run(); |
58 | 61 |
| 62 AudioCodingModule* get_acm() { return acm_.get(); } |
| 63 |
59 protected: | 64 protected: |
60 // Method is called after each block of output audio is received from ACM. | 65 // Method is called after each block of output audio is received from ACM. |
61 virtual void AfterGetAudio() {} | 66 virtual void AfterGetAudio() {} |
62 | 67 |
63 SimulatedClock clock_; | 68 SimulatedClock clock_; |
64 std::unique_ptr<AudioCodingModule> acm_; | 69 std::unique_ptr<AudioCodingModule> acm_; |
65 PacketSource* packet_source_; | 70 PacketSource* packet_source_; |
66 AudioSink* audio_sink_; | 71 AudioSink* audio_sink_; |
67 int output_freq_hz_; | 72 int output_freq_hz_; |
68 NumOutputChannels exptected_output_channels_; | 73 NumOutputChannels exptected_output_channels_; |
(...skipping 19 matching lines...) Expand all Loading... |
88 | 93 |
89 const int output_freq_hz_1_; | 94 const int output_freq_hz_1_; |
90 const int output_freq_hz_2_; | 95 const int output_freq_hz_2_; |
91 const int toggle_period_ms_; | 96 const int toggle_period_ms_; |
92 int64_t last_toggle_time_ms_; | 97 int64_t last_toggle_time_ms_; |
93 }; | 98 }; |
94 | 99 |
95 } // namespace test | 100 } // namespace test |
96 } // namespace webrtc | 101 } // namespace webrtc |
97 #endif // WEBRTC_MODULES_AUDIO_CODING_ACM2_ACM_RECEIVE_TEST_OLDAPI_H_ | 102 #endif // WEBRTC_MODULES_AUDIO_CODING_ACM2_ACM_RECEIVE_TEST_OLDAPI_H_ |
OLD | NEW |