1*d9f75844SAndroid Build Coastguard Worker /* 2*d9f75844SAndroid Build Coastguard Worker * Copyright 2018 The WebRTC project authors. All Rights Reserved. 3*d9f75844SAndroid Build Coastguard Worker * 4*d9f75844SAndroid Build Coastguard Worker * Use of this source code is governed by a BSD-style license 5*d9f75844SAndroid Build Coastguard Worker * that can be found in the LICENSE file in the root of the source 6*d9f75844SAndroid Build Coastguard Worker * tree. An additional intellectual property rights grant can be found 7*d9f75844SAndroid Build Coastguard Worker * in the file PATENTS. All contributing project authors may 8*d9f75844SAndroid Build Coastguard Worker * be found in the AUTHORS file in the root of the source tree. 9*d9f75844SAndroid Build Coastguard Worker */ 10*d9f75844SAndroid Build Coastguard Worker #ifndef TEST_SCENARIO_AUDIO_STREAM_H_ 11*d9f75844SAndroid Build Coastguard Worker #define TEST_SCENARIO_AUDIO_STREAM_H_ 12*d9f75844SAndroid Build Coastguard Worker #include <memory> 13*d9f75844SAndroid Build Coastguard Worker #include <string> 14*d9f75844SAndroid Build Coastguard Worker #include <vector> 15*d9f75844SAndroid Build Coastguard Worker 16*d9f75844SAndroid Build Coastguard Worker #include "test/scenario/call_client.h" 17*d9f75844SAndroid Build Coastguard Worker #include "test/scenario/column_printer.h" 18*d9f75844SAndroid Build Coastguard Worker #include "test/scenario/network_node.h" 19*d9f75844SAndroid Build Coastguard Worker #include "test/scenario/scenario_config.h" 20*d9f75844SAndroid Build Coastguard Worker 21*d9f75844SAndroid Build Coastguard Worker namespace webrtc { 22*d9f75844SAndroid Build Coastguard Worker namespace test { 23*d9f75844SAndroid Build Coastguard Worker 24*d9f75844SAndroid Build Coastguard Worker // SendAudioStream represents sending of audio. It can be used for starting the 25*d9f75844SAndroid Build Coastguard Worker // stream if neccessary. 26*d9f75844SAndroid Build Coastguard Worker class SendAudioStream { 27*d9f75844SAndroid Build Coastguard Worker public: 28*d9f75844SAndroid Build Coastguard Worker ~SendAudioStream(); 29*d9f75844SAndroid Build Coastguard Worker 30*d9f75844SAndroid Build Coastguard Worker SendAudioStream(const SendAudioStream&) = delete; 31*d9f75844SAndroid Build Coastguard Worker SendAudioStream& operator=(const SendAudioStream&) = delete; 32*d9f75844SAndroid Build Coastguard Worker 33*d9f75844SAndroid Build Coastguard Worker void Start(); 34*d9f75844SAndroid Build Coastguard Worker void Stop(); 35*d9f75844SAndroid Build Coastguard Worker void SetMuted(bool mute); 36*d9f75844SAndroid Build Coastguard Worker ColumnPrinter StatsPrinter(); 37*d9f75844SAndroid Build Coastguard Worker 38*d9f75844SAndroid Build Coastguard Worker private: 39*d9f75844SAndroid Build Coastguard Worker friend class Scenario; 40*d9f75844SAndroid Build Coastguard Worker friend class AudioStreamPair; 41*d9f75844SAndroid Build Coastguard Worker friend class ReceiveAudioStream; 42*d9f75844SAndroid Build Coastguard Worker SendAudioStream(CallClient* sender, 43*d9f75844SAndroid Build Coastguard Worker AudioStreamConfig config, 44*d9f75844SAndroid Build Coastguard Worker rtc::scoped_refptr<AudioEncoderFactory> encoder_factory, 45*d9f75844SAndroid Build Coastguard Worker Transport* send_transport); 46*d9f75844SAndroid Build Coastguard Worker AudioSendStream* send_stream_ = nullptr; 47*d9f75844SAndroid Build Coastguard Worker CallClient* const sender_; 48*d9f75844SAndroid Build Coastguard Worker const AudioStreamConfig config_; 49*d9f75844SAndroid Build Coastguard Worker uint32_t ssrc_; 50*d9f75844SAndroid Build Coastguard Worker }; 51*d9f75844SAndroid Build Coastguard Worker 52*d9f75844SAndroid Build Coastguard Worker // ReceiveAudioStream represents an audio receiver. It can't be used directly. 53*d9f75844SAndroid Build Coastguard Worker class ReceiveAudioStream { 54*d9f75844SAndroid Build Coastguard Worker public: 55*d9f75844SAndroid Build Coastguard Worker ~ReceiveAudioStream(); 56*d9f75844SAndroid Build Coastguard Worker 57*d9f75844SAndroid Build Coastguard Worker ReceiveAudioStream(const ReceiveAudioStream&) = delete; 58*d9f75844SAndroid Build Coastguard Worker ReceiveAudioStream& operator=(const ReceiveAudioStream&) = delete; 59*d9f75844SAndroid Build Coastguard Worker 60*d9f75844SAndroid Build Coastguard Worker void Start(); 61*d9f75844SAndroid Build Coastguard Worker void Stop(); 62*d9f75844SAndroid Build Coastguard Worker AudioReceiveStreamInterface::Stats GetStats() const; 63*d9f75844SAndroid Build Coastguard Worker 64*d9f75844SAndroid Build Coastguard Worker private: 65*d9f75844SAndroid Build Coastguard Worker friend class Scenario; 66*d9f75844SAndroid Build Coastguard Worker friend class AudioStreamPair; 67*d9f75844SAndroid Build Coastguard Worker ReceiveAudioStream(CallClient* receiver, 68*d9f75844SAndroid Build Coastguard Worker AudioStreamConfig config, 69*d9f75844SAndroid Build Coastguard Worker SendAudioStream* send_stream, 70*d9f75844SAndroid Build Coastguard Worker rtc::scoped_refptr<AudioDecoderFactory> decoder_factory, 71*d9f75844SAndroid Build Coastguard Worker Transport* feedback_transport); 72*d9f75844SAndroid Build Coastguard Worker AudioReceiveStreamInterface* receive_stream_ = nullptr; 73*d9f75844SAndroid Build Coastguard Worker CallClient* const receiver_; 74*d9f75844SAndroid Build Coastguard Worker const AudioStreamConfig config_; 75*d9f75844SAndroid Build Coastguard Worker }; 76*d9f75844SAndroid Build Coastguard Worker 77*d9f75844SAndroid Build Coastguard Worker // AudioStreamPair represents an audio streaming session. It can be used to 78*d9f75844SAndroid Build Coastguard Worker // access underlying send and receive classes. It can also be used in calls to 79*d9f75844SAndroid Build Coastguard Worker // the Scenario class. 80*d9f75844SAndroid Build Coastguard Worker class AudioStreamPair { 81*d9f75844SAndroid Build Coastguard Worker public: 82*d9f75844SAndroid Build Coastguard Worker ~AudioStreamPair(); 83*d9f75844SAndroid Build Coastguard Worker 84*d9f75844SAndroid Build Coastguard Worker AudioStreamPair(const AudioStreamPair&) = delete; 85*d9f75844SAndroid Build Coastguard Worker AudioStreamPair& operator=(const AudioStreamPair&) = delete; 86*d9f75844SAndroid Build Coastguard Worker send()87*d9f75844SAndroid Build Coastguard Worker SendAudioStream* send() { return &send_stream_; } receive()88*d9f75844SAndroid Build Coastguard Worker ReceiveAudioStream* receive() { return &receive_stream_; } 89*d9f75844SAndroid Build Coastguard Worker 90*d9f75844SAndroid Build Coastguard Worker private: 91*d9f75844SAndroid Build Coastguard Worker friend class Scenario; 92*d9f75844SAndroid Build Coastguard Worker AudioStreamPair(CallClient* sender, 93*d9f75844SAndroid Build Coastguard Worker rtc::scoped_refptr<AudioEncoderFactory> encoder_factory, 94*d9f75844SAndroid Build Coastguard Worker CallClient* receiver, 95*d9f75844SAndroid Build Coastguard Worker rtc::scoped_refptr<AudioDecoderFactory> decoder_factory, 96*d9f75844SAndroid Build Coastguard Worker AudioStreamConfig config); 97*d9f75844SAndroid Build Coastguard Worker 98*d9f75844SAndroid Build Coastguard Worker private: 99*d9f75844SAndroid Build Coastguard Worker const AudioStreamConfig config_; 100*d9f75844SAndroid Build Coastguard Worker SendAudioStream send_stream_; 101*d9f75844SAndroid Build Coastguard Worker ReceiveAudioStream receive_stream_; 102*d9f75844SAndroid Build Coastguard Worker }; 103*d9f75844SAndroid Build Coastguard Worker } // namespace test 104*d9f75844SAndroid Build Coastguard Worker } // namespace webrtc 105*d9f75844SAndroid Build Coastguard Worker 106*d9f75844SAndroid Build Coastguard Worker #endif // TEST_SCENARIO_AUDIO_STREAM_H_ 107