2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
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.
11 #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_TEST_TESTSTEREO_H_
12 #define WEBRTC_MODULES_AUDIO_CODING_MAIN_TEST_TESTSTEREO_H_
16 #include "webrtc/system_wrappers/interface/scoped_ptr.h"
17 #include "webrtc/modules/audio_coding/main/test/ACMTest.h"
18 #include "webrtc/modules/audio_coding/main/test/Channel.h"
19 #include "webrtc/modules/audio_coding/main/test/PCMFile.h"
29 class TestPackStereo : public AudioPacketizationCallback {
34 void RegisterReceiverACM(AudioCodingModule* acm);
36 virtual int32_t SendData(const FrameType frame_type,
37 const uint8_t payload_type,
38 const uint32_t timestamp,
39 const uint8_t* payload_data,
40 const uint16_t payload_size,
41 const RTPFragmentationHeader* fragmentation);
43 uint16_t payload_size();
44 uint32_t timestamp_diff();
45 void reset_payload_size();
46 void set_codec_mode(StereoMonoMode mode);
47 void set_lost_packet(bool lost);
50 AudioCodingModule* receiver_acm_;
52 uint32_t timestamp_diff_;
53 uint32_t last_in_timestamp_;
54 uint64_t total_bytes_;
56 StereoMonoMode codec_mode_;
57 // Simulate packet losses
61 class TestStereo : public ACMTest {
63 explicit TestStereo(int test_mode);
68 // The default value of '-1' indicates that the registration is based only on
69 // codec name and a sampling frequncy matching is not required. This is useful
70 // for codecs which support several sampling frequency.
71 void RegisterSendCodec(char side, char* codec_name, int32_t samp_freq_hz,
72 int rate, int pack_size, int channels,
75 void Run(TestPackStereo* channel, int in_channels, int out_channels,
76 int percent_loss = 0);
77 void OpenOutFile(int16_t test_number);
78 void DisplaySendReceiveCodec();
80 int32_t SendData(const FrameType frame_type, const uint8_t payload_type,
81 const uint32_t timestamp, const uint8_t* payload_data,
82 const uint16_t payload_size,
83 const RTPFragmentationHeader* fragmentation);
87 scoped_ptr<AudioCodingModule> acm_a_;
88 scoped_ptr<AudioCodingModule> acm_b_;
90 TestPackStereo* channel_a2b_;
92 PCMFile* in_file_stereo_;
93 PCMFile* in_file_mono_;
96 uint16_t pack_size_samp_;
97 uint16_t pack_size_bytes_;
99 char* send_codec_name_;
101 // Payload types for stereo codecs and CNG
103 int l16_8khz_pltype_;
104 int l16_16khz_pltype_;
105 int l16_32khz_pltype_;
111 int cn_16khz_pltype_;
112 int cn_32khz_pltype_;
115 } // namespace webrtc
117 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_TEST_TESTSTEREO_H_