blob: 06a91dbd2ef610c60ee159b9b32e2c8d0d987d53 [file] [log] [blame]
Sebastian Jansson98b07e92018-09-27 13:47:01 +02001/*
2 * Copyright 2018 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#ifndef TEST_SCENARIO_AUDIO_STREAM_H_
11#define TEST_SCENARIO_AUDIO_STREAM_H_
12#include <memory>
13#include <string>
14#include <vector>
15
16#include "rtc_base/constructormagic.h"
17#include "test/scenario/call_client.h"
18#include "test/scenario/column_printer.h"
19#include "test/scenario/network_node.h"
20#include "test/scenario/scenario_config.h"
21
22namespace webrtc {
23namespace test {
24
25// SendAudioStream represents sending of audio. It can be used for starting the
26// stream if neccessary.
Sebastian Jansson800e1212018-10-22 11:49:03 +020027class SendAudioStream {
Sebastian Jansson98b07e92018-09-27 13:47:01 +020028 public:
29 RTC_DISALLOW_COPY_AND_ASSIGN(SendAudioStream);
30 ~SendAudioStream();
31 void Start();
32
33 private:
34 friend class Scenario;
35 friend class AudioStreamPair;
36 friend class ReceiveAudioStream;
37 SendAudioStream(CallClient* sender,
38 AudioStreamConfig config,
39 rtc::scoped_refptr<AudioEncoderFactory> encoder_factory,
40 Transport* send_transport);
Sebastian Jansson98b07e92018-09-27 13:47:01 +020041 AudioSendStream* send_stream_ = nullptr;
42 CallClient* const sender_;
43 const AudioStreamConfig config_;
44 uint32_t ssrc_;
45};
46
47// ReceiveAudioStream represents an audio receiver. It can't be used directly.
Sebastian Jansson800e1212018-10-22 11:49:03 +020048class ReceiveAudioStream {
Sebastian Jansson98b07e92018-09-27 13:47:01 +020049 public:
50 RTC_DISALLOW_COPY_AND_ASSIGN(ReceiveAudioStream);
51 ~ReceiveAudioStream();
52
53 private:
54 friend class Scenario;
55 friend class AudioStreamPair;
56 ReceiveAudioStream(CallClient* receiver,
57 AudioStreamConfig config,
58 SendAudioStream* send_stream,
59 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory,
60 Transport* feedback_transport);
Sebastian Jansson98b07e92018-09-27 13:47:01 +020061 AudioReceiveStream* receive_stream_ = nullptr;
62 CallClient* const receiver_;
63 const AudioStreamConfig config_;
64};
65
66// AudioStreamPair represents an audio streaming session. It can be used to
67// access underlying send and receive classes. It can also be used in calls to
68// the Scenario class.
69class AudioStreamPair {
70 public:
71 RTC_DISALLOW_COPY_AND_ASSIGN(AudioStreamPair);
72 ~AudioStreamPair();
73 SendAudioStream* send() { return &send_stream_; }
74 ReceiveAudioStream* receive() { return &receive_stream_; }
75
76 private:
77 friend class Scenario;
78 AudioStreamPair(CallClient* sender,
Sebastian Jansson98b07e92018-09-27 13:47:01 +020079 rtc::scoped_refptr<AudioEncoderFactory> encoder_factory,
Sebastian Jansson98b07e92018-09-27 13:47:01 +020080 CallClient* receiver,
Sebastian Jansson98b07e92018-09-27 13:47:01 +020081 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory,
82 AudioStreamConfig config);
83
84 private:
85 const AudioStreamConfig config_;
Sebastian Jansson98b07e92018-09-27 13:47:01 +020086 SendAudioStream send_stream_;
87 ReceiveAudioStream receive_stream_;
88};
89} // namespace test
90} // namespace webrtc
91
92#endif // TEST_SCENARIO_AUDIO_STREAM_H_