2 * Copyright (c) 2014 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_ACM2_ACM_RECEIVE_TEST_H_
12 #define WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_RECEIVE_TEST_H_
14 #include "webrtc/base/constructormagic.h"
15 #include "webrtc/system_wrappers/interface/clock.h"
16 #include "webrtc/system_wrappers/interface/scoped_ptr.h"
19 class AudioCodingModule;
26 class AcmReceiveTestOldApi {
28 enum NumOutputChannels {
29 kArbitraryChannels = 0,
34 AcmReceiveTestOldApi(PacketSource* packet_source,
35 AudioSink* audio_sink,
37 NumOutputChannels exptected_output_channels);
38 virtual ~AcmReceiveTestOldApi() {}
40 // Registers the codecs with default parameters from ACM.
41 void RegisterDefaultCodecs();
43 // Registers codecs with payload types matching the pre-encoded NetEq test
45 void RegisterNetEqTestCodecs();
47 // Runs the test and returns true if successful.
51 // Method is called after each block of output audio is received from ACM.
52 virtual void AfterGetAudio() {}
54 SimulatedClock clock_;
55 scoped_ptr<AudioCodingModule> acm_;
56 PacketSource* packet_source_;
57 AudioSink* audio_sink_;
59 NumOutputChannels exptected_output_channels_;
61 DISALLOW_COPY_AND_ASSIGN(AcmReceiveTestOldApi);
64 // This test toggles the output frequency every |toggle_period_ms|. The test
65 // starts with |output_freq_hz_1|. Except for the toggling, it does the same
66 // thing as AcmReceiveTestOldApi.
67 class AcmReceiveTestToggleOutputFreqOldApi : public AcmReceiveTestOldApi {
69 AcmReceiveTestToggleOutputFreqOldApi(
70 PacketSource* packet_source,
71 AudioSink* audio_sink,
75 NumOutputChannels exptected_output_channels);
78 void AfterGetAudio() OVERRIDE;
80 const int output_freq_hz_1_;
81 const int output_freq_hz_2_;
82 const int toggle_period_ms_;
83 int64_t last_toggle_time_ms_;
88 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_RECEIVE_TEST_H_