10e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org/* 20e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 30e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org * 40e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org * Use of this source code is governed by a BSD-style license 50e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org * that can be found in the LICENSE file in the root of the source 60e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org * tree. An additional intellectual property rights grant can be found 70e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org * in the file PATENTS. All contributing project authors may 80e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org * be found in the AUTHORS file in the root of the source tree. 90e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org */ 100e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org 113e6db2321ccdc8738c9cecbe9bdab13d4f0f658dkjellander#ifndef WEBRTC_MODULES_AUDIO_CODING_ACM2_ACM_RECEIVE_TEST_OLDAPI_H_ 123e6db2321ccdc8738c9cecbe9bdab13d4f0f658dkjellander#define WEBRTC_MODULES_AUDIO_CODING_ACM2_ACM_RECEIVE_TEST_OLDAPI_H_ 130e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org 144cf61dd116288e9f119209c59e07f1d9439d8d05henrik.lundin#include <string> 154cf61dd116288e9f119209c59e07f1d9439d8d05henrik.lundin 160e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org#include "webrtc/base/constructormagic.h" 1700b8f6b3643332cce1ee711715f7fbb824d793cakwiberg@webrtc.org#include "webrtc/base/scoped_ptr.h" 1898f53510b222f71fdd8b799b2f33737ceeb28c61Henrik Kjellander#include "webrtc/system_wrappers/include/clock.h" 190e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org 200e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.orgnamespace webrtc { 210e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.orgclass AudioCodingModule; 224e14f0961bcd3e70621039403776a14e017aae81kwibergclass AudioDecoder; 230e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.orgstruct CodecInst; 240e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org 250e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.orgnamespace test { 260e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.orgclass AudioSink; 270e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.orgclass PacketSource; 280e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org 290e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.orgclass AcmReceiveTestOldApi { 300e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org public: 310e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org enum NumOutputChannels { 320e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org kArbitraryChannels = 0, 330e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org kMonoOutput = 1, 340e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org kStereoOutput = 2 350e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org }; 360e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org 370e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org AcmReceiveTestOldApi(PacketSource* packet_source, 380e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org AudioSink* audio_sink, 390e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org int output_freq_hz, 400e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org NumOutputChannels exptected_output_channels); 410e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org virtual ~AcmReceiveTestOldApi() {} 420e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org 430e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org // Registers the codecs with default parameters from ACM. 440e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org void RegisterDefaultCodecs(); 450e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org 460e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org // Registers codecs with payload types matching the pre-encoded NetEq test 470e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org // files. 480e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org void RegisterNetEqTestCodecs(); 490e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org 504e14f0961bcd3e70621039403776a14e017aae81kwiberg int RegisterExternalReceiveCodec(int rtp_payload_type, 514e14f0961bcd3e70621039403776a14e017aae81kwiberg AudioDecoder* external_decoder, 524e14f0961bcd3e70621039403776a14e017aae81kwiberg int sample_rate_hz, 534cf61dd116288e9f119209c59e07f1d9439d8d05henrik.lundin int num_channels, 544cf61dd116288e9f119209c59e07f1d9439d8d05henrik.lundin const std::string& name); 554e14f0961bcd3e70621039403776a14e017aae81kwiberg 560e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org // Runs the test and returns true if successful. 570e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org void Run(); 580e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org 5981a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org protected: 6081a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org // Method is called after each block of output audio is received from ACM. 6181a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org virtual void AfterGetAudio() {} 6281a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org 630e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org SimulatedClock clock_; 6400b8f6b3643332cce1ee711715f7fbb824d793cakwiberg@webrtc.org rtc::scoped_ptr<AudioCodingModule> acm_; 650e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org PacketSource* packet_source_; 660e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org AudioSink* audio_sink_; 6781a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org int output_freq_hz_; 680e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org NumOutputChannels exptected_output_channels_; 690e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org 703c089d751ede283e21e186885eaf705c3257ccd2henrikg RTC_DISALLOW_COPY_AND_ASSIGN(AcmReceiveTestOldApi); 710e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org}; 720e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org 7381a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org// This test toggles the output frequency every |toggle_period_ms|. The test 7481a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org// starts with |output_freq_hz_1|. Except for the toggling, it does the same 7581a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org// thing as AcmReceiveTestOldApi. 7681a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.orgclass AcmReceiveTestToggleOutputFreqOldApi : public AcmReceiveTestOldApi { 7781a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org public: 7881a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org AcmReceiveTestToggleOutputFreqOldApi( 7981a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org PacketSource* packet_source, 8081a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org AudioSink* audio_sink, 8181a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org int output_freq_hz_1, 8281a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org int output_freq_hz_2, 8381a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org int toggle_period_ms, 8481a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org NumOutputChannels exptected_output_channels); 8581a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org 8681a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org protected: 8714665ff7d4024d07e58622f498b23fd980001871kjellander@webrtc.org void AfterGetAudio() override; 8881a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org 8981a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org const int output_freq_hz_1_; 9081a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org const int output_freq_hz_2_; 9181a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org const int toggle_period_ms_; 9281a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org int64_t last_toggle_time_ms_; 9381a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org}; 9481a78930eeeede0fdaeb0553c6b57acb33f985e7henrik.lundin@webrtc.org 950e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org} // namespace test 960e6e4d2ff2dc3458ad74aa994a106481df198cd2henrik.lundin@webrtc.org} // namespace webrtc 973e6db2321ccdc8738c9cecbe9bdab13d4f0f658dkjellander#endif // WEBRTC_MODULES_AUDIO_CODING_ACM2_ACM_RECEIVE_TEST_OLDAPI_H_ 98