Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: webrtc/test/call_test.h

Issue 1542653002: Add audio streams to CallTest and a first A/V call test. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Win issue fixed. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 #ifndef WEBRTC_TEST_COMMON_CALL_TEST_H_ 10 #ifndef WEBRTC_TEST_COMMON_CALL_TEST_H_
11 #define WEBRTC_TEST_COMMON_CALL_TEST_H_ 11 #define WEBRTC_TEST_COMMON_CALL_TEST_H_
12 12
13 #include <vector> 13 #include <vector>
14 14
15 #include "webrtc/call.h" 15 #include "webrtc/call.h"
16 #include "webrtc/call/transport_adapter.h"
16 #include "webrtc/system_wrappers/include/scoped_vector.h" 17 #include "webrtc/system_wrappers/include/scoped_vector.h"
18 #include "webrtc/test/fake_audio_device.h"
17 #include "webrtc/test/fake_decoder.h" 19 #include "webrtc/test/fake_decoder.h"
18 #include "webrtc/test/fake_encoder.h" 20 #include "webrtc/test/fake_encoder.h"
19 #include "webrtc/test/frame_generator_capturer.h" 21 #include "webrtc/test/frame_generator_capturer.h"
20 #include "webrtc/test/rtp_rtcp_observer.h" 22 #include "webrtc/test/rtp_rtcp_observer.h"
21 23
22 namespace webrtc { 24 namespace webrtc {
25
26 class VoEBase;
27 class VoECodec;
28 class VoENetwork;
29
23 namespace test { 30 namespace test {
24 31
25 class BaseTest; 32 class BaseTest;
26 33
27 class CallTest : public ::testing::Test { 34 class CallTest : public ::testing::Test {
28 public: 35 public:
29 CallTest(); 36 CallTest();
30 ~CallTest(); 37 virtual ~CallTest();
31 38
32 static const size_t kNumSsrcs = 3; 39 static const size_t kNumSsrcs = 3;
33 40
34 static const int kDefaultTimeoutMs; 41 static const int kDefaultTimeoutMs;
35 static const int kLongTimeoutMs; 42 static const int kLongTimeoutMs;
36 static const uint8_t kSendPayloadType; 43 static const uint8_t kVideoSendPayloadType;
37 static const uint8_t kSendRtxPayloadType; 44 static const uint8_t kSendRtxPayloadType;
38 static const uint8_t kFakeSendPayloadType; 45 static const uint8_t kFakeVideoSendPayloadType;
39 static const uint8_t kRedPayloadType; 46 static const uint8_t kRedPayloadType;
40 static const uint8_t kRtxRedPayloadType; 47 static const uint8_t kRtxRedPayloadType;
41 static const uint8_t kUlpfecPayloadType; 48 static const uint8_t kUlpfecPayloadType;
49 static const uint8_t kAudioSendPayloadType;
42 static const uint32_t kSendRtxSsrcs[kNumSsrcs]; 50 static const uint32_t kSendRtxSsrcs[kNumSsrcs];
43 static const uint32_t kSendSsrcs[kNumSsrcs]; 51 static const uint32_t kVideoSendSsrcs[kNumSsrcs];
44 static const uint32_t kReceiverLocalSsrc; 52 static const uint32_t kAudioSendSsrc;
53 static const uint32_t kReceiverLocalVideoSsrc;
54 static const uint32_t kReceiverLocalAudioSsrc;
45 static const int kNackRtpHistoryMs; 55 static const int kNackRtpHistoryMs;
46 56
47 protected: 57 protected:
48 void RunBaseTest(BaseTest* test, const FakeNetworkPipe::Config& config); 58 void RunBaseTest(BaseTest* test, const FakeNetworkPipe::Config& config);
49 59
50 void CreateCalls(const Call::Config& sender_config, 60 void CreateCalls(const Call::Config& sender_config,
51 const Call::Config& receiver_config); 61 const Call::Config& receiver_config);
52 void CreateSenderCall(const Call::Config& config); 62 void CreateSenderCall(const Call::Config& config);
53 void CreateReceiverCall(const Call::Config& config); 63 void CreateReceiverCall(const Call::Config& config);
54 void DestroyCalls(); 64 void DestroyCalls();
55 65
56 void CreateSendConfig(size_t num_streams, Transport* send_transport); 66 void CreateSendConfig(size_t num_video_streams,
57 void CreateMatchingReceiveConfigs(Transport* rtcp_send_transport); 67 size_t num_audio_streams,
68 Transport* send_transport);
69 void CreateMatchingReceiveConfigs(bool create_audio_recv_stream,
pbos-webrtc 2016/01/07 14:23:37 Store how many was created in CreateSendConfig and
stefan-webrtc 2016/01/07 15:16:44 Done.
70 Transport* rtcp_send_transport);
58 71
59 void CreateFrameGeneratorCapturer(); 72 void CreateFrameGeneratorCapturer();
73 void CreateFakeAudioDevices();
60 74
61 void CreateStreams(); 75 void CreateVideoStreams();
76 void CreateAudioStreams();
62 void Start(); 77 void Start();
63 void Stop(); 78 void Stop();
64 void DestroyStreams(); 79 void DestroyStreams();
65 80
66 Clock* const clock_; 81 Clock* const clock_;
67 82
68 rtc::scoped_ptr<Call> sender_call_; 83 rtc::scoped_ptr<Call> sender_call_;
69 rtc::scoped_ptr<PacketTransport> send_transport_; 84 rtc::scoped_ptr<PacketTransport> send_transport_;
70 VideoSendStream::Config video_send_config_; 85 VideoSendStream::Config video_send_config_;
71 VideoEncoderConfig video_encoder_config_; 86 VideoEncoderConfig video_encoder_config_;
72 VideoSendStream* video_send_stream_; 87 VideoSendStream* video_send_stream_;
88 AudioSendStream::Config audio_send_config_;
89 AudioSendStream* audio_send_stream_;
73 90
74 rtc::scoped_ptr<Call> receiver_call_; 91 rtc::scoped_ptr<Call> receiver_call_;
75 rtc::scoped_ptr<PacketTransport> receive_transport_; 92 rtc::scoped_ptr<PacketTransport> receive_transport_;
76 std::vector<VideoReceiveStream::Config> video_receive_configs_; 93 std::vector<VideoReceiveStream::Config> video_receive_configs_;
77 std::vector<VideoReceiveStream*> video_receive_streams_; 94 std::vector<VideoReceiveStream*> video_receive_streams_;
95 std::vector<AudioReceiveStream::Config> audio_receive_configs_;
96 std::vector<AudioReceiveStream*> audio_receive_streams_;
78 97
79 rtc::scoped_ptr<test::FrameGeneratorCapturer> frame_generator_capturer_; 98 rtc::scoped_ptr<test::FrameGeneratorCapturer> frame_generator_capturer_;
80 test::FakeEncoder fake_encoder_; 99 test::FakeEncoder fake_encoder_;
81 ScopedVector<VideoDecoder> allocated_decoders_; 100 ScopedVector<VideoDecoder> allocated_decoders_;
101
102 private:
103 // TODO(holmer): Remove once voice engine is fully refactored to the new API.
pbos-webrtc 2016/01/07 14:23:37 VoiceEngine
stefan-webrtc 2016/01/07 15:16:44 Done.
104 // These methods are used to set up legacy voice engines and channels which is
105 // necessary while voice engine is being refactored to the new stream API.
106 void CreateVoiceEngines();
107 void SetupVoiceEngineTransports(PacketTransport* send_transport,
108 PacketTransport* recv_transport);
109 void DestroyVoiceEngines();
110
111 int voe_send_channel_id_;
112 int voe_recv_channel_id_;
113
114 VoiceEngine* send_voice_engine_;
pbos-webrtc 2016/01/07 14:23:37 Split into send/recv member "blocks", maybe a stru
stefan-webrtc 2016/01/07 15:16:44 Done.
115 VoiceEngine* recv_voice_engine_;
116 VoEBase* voe_send_base_;
117 VoENetwork* voe_send_network_;
118 VoECodec* voe_send_codec_;
119 VoEBase* voe_recv_base_;
120 VoENetwork* voe_recv_network_;
121 VoECodec* voe_recv_codec_;
122 rtc::scoped_ptr<internal::TransportAdapter> voe_send_transport_adapter_;
123 rtc::scoped_ptr<internal::TransportAdapter> voe_recv_transport_adapter_;
124
125 // The audio devices must outlive the voice engines.
126 rtc::scoped_ptr<test::FakeAudioDevice> fake_send_audio_device_;
127 rtc::scoped_ptr<test::FakeAudioDevice> fake_recv_audio_device_;
82 }; 128 };
83 129
84 class BaseTest : public RtpRtcpObserver { 130 class BaseTest : public RtpRtcpObserver {
85 public: 131 public:
86 explicit BaseTest(unsigned int timeout_ms); 132 explicit BaseTest(unsigned int timeout_ms);
87 virtual ~BaseTest(); 133 virtual ~BaseTest();
88 134
89 virtual void PerformTest() = 0; 135 virtual void PerformTest() = 0;
90 virtual bool ShouldCreateReceivers() const = 0; 136 virtual bool ShouldCreateReceivers() const = 0;
91 137
92 virtual size_t GetNumStreams() const; 138 virtual size_t GetNumVideoStreams() const;
139 virtual size_t GetNumAudioStreams() const;
93 140
94 virtual Call::Config GetSenderCallConfig(); 141 virtual Call::Config GetSenderCallConfig();
95 virtual Call::Config GetReceiverCallConfig(); 142 virtual Call::Config GetReceiverCallConfig();
96 virtual void OnCallsCreated(Call* sender_call, Call* receiver_call); 143 virtual void OnCallsCreated(Call* sender_call, Call* receiver_call);
97 virtual void OnTransportsCreated(PacketTransport* send_transport, 144 virtual void OnTransportsCreated(PacketTransport* send_transport,
98 PacketTransport* receive_transport); 145 PacketTransport* receive_transport);
99 146
100 virtual void ModifyVideoConfigs( 147 virtual void ModifyVideoConfigs(
101 VideoSendStream::Config* send_config, 148 VideoSendStream::Config* send_config,
102 std::vector<VideoReceiveStream::Config>* receive_configs, 149 std::vector<VideoReceiveStream::Config>* receive_configs,
103 VideoEncoderConfig* encoder_config); 150 VideoEncoderConfig* encoder_config);
104 virtual void OnVideoStreamsCreated( 151 virtual void OnVideoStreamsCreated(
105 VideoSendStream* send_stream, 152 VideoSendStream* send_stream,
106 const std::vector<VideoReceiveStream*>& receive_streams); 153 const std::vector<VideoReceiveStream*>& receive_streams);
107 154
155 virtual void ModifyAudioConfigs(
156 AudioSendStream::Config* send_config,
157 std::vector<AudioReceiveStream::Config>* receive_configsg);
pbos-webrtc 2016/01/07 14:23:37 configsgsgsgsgsgsgsg
stefan-webrtc 2016/01/07 15:16:44 Done.
158 virtual void OnAudioStreamsCreated(
159 AudioSendStream* send_stream,
160 const std::vector<AudioReceiveStream*>& receive_streams);
161
108 virtual void OnFrameGeneratorCapturerCreated( 162 virtual void OnFrameGeneratorCapturerCreated(
109 FrameGeneratorCapturer* frame_generator_capturer); 163 FrameGeneratorCapturer* frame_generator_capturer);
110 }; 164 };
111 165
112 class SendTest : public BaseTest { 166 class SendTest : public BaseTest {
113 public: 167 public:
114 explicit SendTest(unsigned int timeout_ms); 168 explicit SendTest(unsigned int timeout_ms);
115 169
116 bool ShouldCreateReceivers() const override; 170 bool ShouldCreateReceivers() const override;
117 }; 171 };
118 172
119 class EndToEndTest : public BaseTest { 173 class EndToEndTest : public BaseTest {
120 public: 174 public:
121 explicit EndToEndTest(unsigned int timeout_ms); 175 explicit EndToEndTest(unsigned int timeout_ms);
122 176
123 bool ShouldCreateReceivers() const override; 177 bool ShouldCreateReceivers() const override;
124 }; 178 };
125 179
126 } // namespace test 180 } // namespace test
127 } // namespace webrtc 181 } // namespace webrtc
128 182
129 #endif // WEBRTC_TEST_COMMON_CALL_TEST_H_ 183 #endif // WEBRTC_TEST_COMMON_CALL_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698