OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | |
3 * | |
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 | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_TEST_TESTALLCODECS_H_ | |
12 #define WEBRTC_MODULES_AUDIO_CODING_MAIN_TEST_TESTALLCODECS_H_ | |
13 | |
14 #include "webrtc/base/scoped_ptr.h" | |
15 #include "webrtc/modules/audio_coding/main/test/ACMTest.h" | |
16 #include "webrtc/modules/audio_coding/main/test/Channel.h" | |
17 #include "webrtc/modules/audio_coding/main/test/PCMFile.h" | |
18 #include "webrtc/typedefs.h" | |
19 | |
20 namespace webrtc { | |
21 | |
22 class Config; | |
23 | |
24 class TestPack : public AudioPacketizationCallback { | |
25 public: | |
26 TestPack(); | |
27 ~TestPack(); | |
28 | |
29 void RegisterReceiverACM(AudioCodingModule* acm); | |
30 | |
31 int32_t SendData(FrameType frame_type, | |
32 uint8_t payload_type, | |
33 uint32_t timestamp, | |
34 const uint8_t* payload_data, | |
35 size_t payload_size, | |
36 const RTPFragmentationHeader* fragmentation) override; | |
37 | |
38 size_t payload_size(); | |
39 uint32_t timestamp_diff(); | |
40 void reset_payload_size(); | |
41 | |
42 private: | |
43 AudioCodingModule* receiver_acm_; | |
44 uint16_t sequence_number_; | |
45 uint8_t payload_data_[60 * 32 * 2 * 2]; | |
46 uint32_t timestamp_diff_; | |
47 uint32_t last_in_timestamp_; | |
48 uint64_t total_bytes_; | |
49 size_t payload_size_; | |
50 }; | |
51 | |
52 class TestAllCodecs : public ACMTest { | |
53 public: | |
54 explicit TestAllCodecs(int test_mode); | |
55 ~TestAllCodecs(); | |
56 | |
57 void Perform() override; | |
58 | |
59 private: | |
60 // The default value of '-1' indicates that the registration is based only on | |
61 // codec name, and a sampling frequency matching is not required. | |
62 // This is useful for codecs which support several sampling frequency. | |
63 // Note! Only mono mode is tested in this test. | |
64 void RegisterSendCodec(char side, char* codec_name, int32_t sampling_freq_hz, | |
65 int rate, int packet_size, size_t extra_byte); | |
66 | |
67 void Run(TestPack* channel); | |
68 void OpenOutFile(int test_number); | |
69 void DisplaySendReceiveCodec(); | |
70 | |
71 int test_mode_; | |
72 rtc::scoped_ptr<AudioCodingModule> acm_a_; | |
73 rtc::scoped_ptr<AudioCodingModule> acm_b_; | |
74 TestPack* channel_a_to_b_; | |
75 PCMFile infile_a_; | |
76 PCMFile outfile_b_; | |
77 int test_count_; | |
78 int packet_size_samples_; | |
79 size_t packet_size_bytes_; | |
80 }; | |
81 | |
82 } // namespace webrtc | |
83 | |
84 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_TEST_TESTALLCODECS_H_ | |
OLD | NEW |