blob: 20fe45e524d00efee91877359c6ec7fb5705f013 [file] [log] [blame]
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +00001/*
2 * libjingle
3 * Copyright 2004 Google Inc.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#include <map>
pbos@webrtc.org86f613d2014-06-10 08:53:05 +000029#include <vector>
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +000030
31#include "talk/base/gunit.h"
32#include "talk/media/base/testutils.h"
33#include "talk/media/base/videoengine_unittest.h"
34#include "talk/media/webrtc/webrtcvideoengine2.h"
pbos@webrtc.org86f613d2014-06-10 08:53:05 +000035#include "talk/media/webrtc/webrtcvideoengine2_unittest.h"
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +000036#include "talk/media/webrtc/webrtcvideochannelfactory.h"
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +000037
38namespace {
39static const cricket::VideoCodec kVp8Codec720p(100, "VP8", 1280, 720, 30, 0);
40static const cricket::VideoCodec kVp8Codec360p(100, "VP8", 640, 360, 30, 0);
41static const cricket::VideoCodec kVp8Codec270p(100, "VP8", 480, 270, 30, 0);
42static const cricket::VideoCodec kVp8Codec180p(100, "VP8", 320, 180, 30, 0);
43
44static const cricket::VideoCodec kVp8Codec(100, "VP8", 640, 400, 30, 0);
45static const cricket::VideoCodec kVp9Codec(101, "VP9", 640, 400, 30, 0);
46static const cricket::VideoCodec kRedCodec(116, "red", 0, 0, 0, 0);
47static const cricket::VideoCodec kUlpfecCodec(117, "ulpfec", 0, 0, 0, 0);
48
49static const uint32 kSsrcs1[] = {1};
50static const uint32 kRtxSsrcs1[] = {4};
pbos@webrtc.orgf99c2f22014-06-13 12:27:38 +000051
52void VerifyCodecHasDefaultFeedbackParams(const cricket::VideoCodec& codec) {
53 EXPECT_TRUE(codec.HasFeedbackParam(cricket::FeedbackParam(
54 cricket::kRtcpFbParamNack, cricket::kParamValueEmpty)));
55 EXPECT_TRUE(codec.HasFeedbackParam(cricket::FeedbackParam(
56 cricket::kRtcpFbParamNack, cricket::kRtcpFbNackParamPli)));
57 EXPECT_TRUE(codec.HasFeedbackParam(cricket::FeedbackParam(
58 cricket::kRtcpFbParamRemb, cricket::kParamValueEmpty)));
59 EXPECT_TRUE(codec.HasFeedbackParam(cricket::FeedbackParam(
60 cricket::kRtcpFbParamCcm, cricket::kRtcpFbCcmParamFir)));
61}
62
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +000063} // namespace
64
65namespace cricket {
pbos@webrtc.org86f613d2014-06-10 08:53:05 +000066FakeVideoSendStream::FakeVideoSendStream(
67 const webrtc::VideoSendStream::Config& config,
68 const std::vector<webrtc::VideoStream>& video_streams)
69 : sending_(false), config_(config), video_streams_(video_streams) {
70}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +000071
pbos@webrtc.org86f613d2014-06-10 08:53:05 +000072webrtc::VideoSendStream::Config FakeVideoSendStream::GetConfig() {
73 return config_;
74}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +000075
pbos@webrtc.org86f613d2014-06-10 08:53:05 +000076std::vector<webrtc::VideoStream> FakeVideoSendStream::GetVideoStreams() {
77 return video_streams_;
78}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +000079
pbos@webrtc.org86f613d2014-06-10 08:53:05 +000080bool FakeVideoSendStream::IsSending() {
81 return sending_;
82}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +000083
pbos@webrtc.org86f613d2014-06-10 08:53:05 +000084webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() const {
85 return webrtc::VideoSendStream::Stats();
86}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +000087
pbos@webrtc.org86f613d2014-06-10 08:53:05 +000088bool FakeVideoSendStream::ReconfigureVideoEncoder(
89 const std::vector<webrtc::VideoStream>& streams,
90 const void* encoder_specific) {
91 video_streams_ = streams;
92 return true;
93}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +000094
pbos@webrtc.org86f613d2014-06-10 08:53:05 +000095webrtc::VideoSendStreamInput* FakeVideoSendStream::Input() {
96 // TODO(pbos): Fix.
97 return NULL;
98}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +000099
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000100void FakeVideoSendStream::Start() {
101 sending_ = true;
102}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000103
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000104void FakeVideoSendStream::Stop() {
105 sending_ = false;
106}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000107
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000108FakeVideoReceiveStream::FakeVideoReceiveStream(
109 const webrtc::VideoReceiveStream::Config& config)
110 : config_(config), receiving_(false) {
111}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000112
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000113webrtc::VideoReceiveStream::Config FakeVideoReceiveStream::GetConfig() {
114 return config_;
115}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000116
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000117webrtc::VideoReceiveStream::Stats FakeVideoReceiveStream::GetStats() const {
118 return webrtc::VideoReceiveStream::Stats();
119}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000120
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000121void FakeVideoReceiveStream::Start() {
122 receiving_ = true;
123}
124void FakeVideoReceiveStream::Stop() {
125 receiving_ = false;
126}
127void FakeVideoReceiveStream::GetCurrentReceiveCodec(webrtc::VideoCodec* codec) {
128}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000129
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000130FakeCall::FakeCall() { SetVideoCodecs(GetDefaultVideoCodecs()); }
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000131
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000132FakeCall::~FakeCall() {
133 EXPECT_EQ(0u, video_send_streams_.size());
134 EXPECT_EQ(0u, video_receive_streams_.size());
135}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000136
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000137void FakeCall::SetVideoCodecs(const std::vector<webrtc::VideoCodec> codecs) {
138 codecs_ = codecs;
139}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000140
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000141std::vector<FakeVideoSendStream*> FakeCall::GetVideoSendStreams() {
142 return video_send_streams_;
143}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000144
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000145std::vector<FakeVideoReceiveStream*> FakeCall::GetVideoReceiveStreams() {
146 return video_receive_streams_;
147}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000148
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000149webrtc::VideoCodec FakeCall::GetEmptyVideoCodec() {
150 webrtc::VideoCodec codec;
151 codec.minBitrate = 300;
152 codec.startBitrate = 800;
153 codec.maxBitrate = 1500;
154 codec.maxFramerate = 10;
155 codec.width = 640;
156 codec.height = 480;
157 codec.qpMax = 56;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000158
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000159 return codec;
160}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000161
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000162webrtc::VideoCodec FakeCall::GetVideoCodecVp8() {
163 webrtc::VideoCodec vp8_codec = GetEmptyVideoCodec();
164 vp8_codec.codecType = webrtc::kVideoCodecVP8;
165 strcpy(vp8_codec.plName, kVp8Codec.name.c_str());
166 vp8_codec.plType = kVp8Codec.id;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000167
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000168 return vp8_codec;
169}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000170
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000171webrtc::VideoCodec FakeCall::GetVideoCodecVp9() {
172 webrtc::VideoCodec vp9_codec = GetEmptyVideoCodec();
173 // TODO(pbos): Add a correct codecType when webrtc has one.
174 vp9_codec.codecType = webrtc::kVideoCodecVP8;
175 strcpy(vp9_codec.plName, kVp9Codec.name.c_str());
176 vp9_codec.plType = kVp9Codec.id;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000177
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000178 return vp9_codec;
179}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000180
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000181std::vector<webrtc::VideoCodec> FakeCall::GetDefaultVideoCodecs() {
182 std::vector<webrtc::VideoCodec> codecs;
183 codecs.push_back(GetVideoCodecVp8());
184 // codecs.push_back(GetVideoCodecVp9());
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000185
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000186 return codecs;
187}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000188
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000189webrtc::VideoSendStream* FakeCall::CreateVideoSendStream(
190 const webrtc::VideoSendStream::Config& config,
191 const std::vector<webrtc::VideoStream>& video_streams,
192 const void* encoder_settings) {
193 FakeVideoSendStream* fake_stream =
194 new FakeVideoSendStream(config, video_streams);
195 video_send_streams_.push_back(fake_stream);
196 return fake_stream;
197}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000198
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000199void FakeCall::DestroyVideoSendStream(webrtc::VideoSendStream* send_stream) {
200 FakeVideoSendStream* fake_stream =
201 static_cast<FakeVideoSendStream*>(send_stream);
202 for (size_t i = 0; i < video_send_streams_.size(); ++i) {
203 if (video_send_streams_[i] == fake_stream) {
204 delete video_send_streams_[i];
205 video_send_streams_.erase(video_send_streams_.begin() + i);
206 return;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000207 }
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000208 }
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000209 ADD_FAILURE() << "DestroyVideoSendStream called with unknown paramter.";
210}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000211
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000212webrtc::VideoReceiveStream* FakeCall::CreateVideoReceiveStream(
213 const webrtc::VideoReceiveStream::Config& config) {
214 video_receive_streams_.push_back(new FakeVideoReceiveStream(config));
215 return video_receive_streams_[video_receive_streams_.size() - 1];
216}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000217
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000218void FakeCall::DestroyVideoReceiveStream(
219 webrtc::VideoReceiveStream* receive_stream) {
220 FakeVideoReceiveStream* fake_stream =
221 static_cast<FakeVideoReceiveStream*>(receive_stream);
222 for (size_t i = 0; i < video_receive_streams_.size(); ++i) {
223 if (video_receive_streams_[i] == fake_stream) {
224 delete video_receive_streams_[i];
225 video_receive_streams_.erase(video_receive_streams_.begin() + i);
226 return;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000227 }
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000228 }
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000229 ADD_FAILURE() << "DestroyVideoReceiveStream called with unknown paramter.";
230}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000231
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000232webrtc::PacketReceiver* FakeCall::Receiver() {
233 // TODO(pbos): Fix this.
234 return NULL;
235}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000236
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000237uint32_t FakeCall::SendBitrateEstimate() {
238 return 0;
239}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000240
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000241uint32_t FakeCall::ReceiveBitrateEstimate() {
242 return 0;
243}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000244
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000245FakeWebRtcVideoChannel2::FakeWebRtcVideoChannel2(
246 FakeCall* call,
247 WebRtcVideoEngine2* engine,
248 VoiceMediaChannel* voice_channel)
249 : WebRtcVideoChannel2(call, engine, engine->GetVideoEncoderFactory()),
250 fake_call_(call),
251 voice_channel_(voice_channel) {
252}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000253
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000254FakeWebRtcVideoChannel2::~FakeWebRtcVideoChannel2() {
255}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000256
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000257VoiceMediaChannel* FakeWebRtcVideoChannel2::GetVoiceChannel() {
258 return voice_channel_;
259}
260FakeCall* FakeWebRtcVideoChannel2::GetFakeCall() {
261 return fake_call_;
262}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000263
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000264FakeWebRtcVideoChannel2* FakeWebRtcVideoMediaChannelFactory::GetFakeChannel(
265 VideoMediaChannel* channel) {
266 return channel_map_[channel];
267}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000268
pbos@webrtc.org86f613d2014-06-10 08:53:05 +0000269WebRtcVideoChannel2* FakeWebRtcVideoMediaChannelFactory::Create(
270 WebRtcVideoEngine2* engine,
271 VoiceMediaChannel* voice_channel) {
272 FakeWebRtcVideoChannel2* channel =
273 new FakeWebRtcVideoChannel2(new FakeCall(), engine, voice_channel);
274 channel_map_[channel] = channel;
275 return channel;
276}
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000277
278class WebRtcVideoEngine2Test : public testing::Test {
279 public:
pbos@webrtc.org9fbb7172014-06-13 09:34:13 +0000280 WebRtcVideoEngine2Test() : engine_(&factory_) {
281 std::vector<VideoCodec> engine_codecs = engine_.codecs();
282 assert(!engine_codecs.empty());
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000283 bool codec_set = false;
pbos@webrtc.org9fbb7172014-06-13 09:34:13 +0000284 for (size_t i = 0; i < engine_codecs.size(); ++i) {
285 if (engine_codecs[i].name == "red") {
286 default_red_codec_ = engine_codecs[i];
287 } else if (engine_codecs[i].name == "ulpfec") {
288 default_ulpfec_codec_ = engine_codecs[i];
289 } else if (engine_codecs[i].name == "rtx") {
290 default_rtx_codec_ = engine_codecs[i];
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000291 } else if (!codec_set) {
pbos@webrtc.org9fbb7172014-06-13 09:34:13 +0000292 default_codec_ = engine_codecs[i];
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000293 codec_set = true;
294 }
295 }
296
297 assert(codec_set);
298 }
299
300 protected:
301 FakeWebRtcVideoMediaChannelFactory factory_;
302 WebRtcVideoEngine2 engine_;
303 VideoCodec default_codec_;
304 VideoCodec default_red_codec_;
305 VideoCodec default_ulpfec_codec_;
306 VideoCodec default_rtx_codec_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000307};
308
309TEST_F(WebRtcVideoEngine2Test, CreateChannel) {
310 talk_base::scoped_ptr<VideoMediaChannel> channel(engine_.CreateChannel(NULL));
311 ASSERT_TRUE(channel.get() != NULL) << "Could not create channel.";
312 EXPECT_TRUE(factory_.GetFakeChannel(channel.get()) != NULL)
313 << "Channel not created through factory.";
314}
315
316TEST_F(WebRtcVideoEngine2Test, CreateChannelWithVoiceEngine) {
317 VoiceMediaChannel* voice_channel = reinterpret_cast<VoiceMediaChannel*>(0x42);
318 talk_base::scoped_ptr<VideoMediaChannel> channel(
319 engine_.CreateChannel(voice_channel));
320 ASSERT_TRUE(channel.get() != NULL) << "Could not create channel.";
321
322 FakeWebRtcVideoChannel2* fake_channel =
323 factory_.GetFakeChannel(channel.get());
324 ASSERT_TRUE(fake_channel != NULL) << "Channel not created through factory.";
325
326 EXPECT_TRUE(fake_channel->GetVoiceChannel() != NULL)
327 << "VoiceChannel not set.";
328 EXPECT_EQ(voice_channel, fake_channel->GetVoiceChannel())
329 << "Different VoiceChannel set than the provided one.";
330}
331
pbos@webrtc.orge322a172014-06-13 11:47:28 +0000332TEST_F(WebRtcVideoEngine2Test, FindCodec) {
333 const std::vector<cricket::VideoCodec>& c = engine_.codecs();
334 EXPECT_EQ(4U, c.size());
335
336 cricket::VideoCodec vp8(104, "VP8", 320, 200, 30, 0);
337 EXPECT_TRUE(engine_.FindCodec(vp8));
338
339 cricket::VideoCodec vp8_ci(104, "vp8", 320, 200, 30, 0);
340 EXPECT_TRUE(engine_.FindCodec(vp8));
341
342 cricket::VideoCodec vp8_diff_fr_diff_pref(104, "VP8", 320, 200, 50, 50);
343 EXPECT_TRUE(engine_.FindCodec(vp8_diff_fr_diff_pref));
344
345 cricket::VideoCodec vp8_diff_id(95, "VP8", 320, 200, 30, 0);
346 EXPECT_FALSE(engine_.FindCodec(vp8_diff_id));
347 vp8_diff_id.id = 97;
348 EXPECT_TRUE(engine_.FindCodec(vp8_diff_id));
349
350 cricket::VideoCodec vp8_diff_res(104, "VP8", 320, 111, 30, 0);
351 EXPECT_FALSE(engine_.FindCodec(vp8_diff_res));
352
353 // PeerConnection doesn't negotiate the resolution at this point.
354 // Test that FindCodec can handle the case when width/height is 0.
355 cricket::VideoCodec vp8_zero_res(104, "VP8", 0, 0, 30, 0);
356 EXPECT_TRUE(engine_.FindCodec(vp8_zero_res));
357
358 cricket::VideoCodec red(101, "RED", 0, 0, 30, 0);
359 EXPECT_TRUE(engine_.FindCodec(red));
360
361 cricket::VideoCodec red_ci(101, "red", 0, 0, 30, 0);
362 EXPECT_TRUE(engine_.FindCodec(red));
363
364 cricket::VideoCodec fec(102, "ULPFEC", 0, 0, 30, 0);
365 EXPECT_TRUE(engine_.FindCodec(fec));
366
367 cricket::VideoCodec fec_ci(102, "ulpfec", 0, 0, 30, 0);
368 EXPECT_TRUE(engine_.FindCodec(fec));
369
370 cricket::VideoCodec rtx(96, "rtx", 0, 0, 30, 0);
371 EXPECT_TRUE(engine_.FindCodec(rtx));
372}
373
374TEST_F(WebRtcVideoEngine2Test, DefaultRtxCodecHasAssociatedPayloadTypeSet) {
375 std::vector<VideoCodec> engine_codecs = engine_.codecs();
376 for (size_t i = 0; i < engine_codecs.size(); ++i) {
377 if (engine_codecs[i].name != kRtxCodecName)
378 continue;
379 int associated_payload_type;
380 EXPECT_TRUE(engine_codecs[i].GetParam(kCodecParamAssociatedPayloadType,
381 &associated_payload_type));
382 EXPECT_EQ(default_codec_.id, associated_payload_type);
383 return;
384 }
385 FAIL() << "No RTX codec found among default codecs.";
386}
387
pbos@webrtc.org587ef602014-06-16 17:32:02 +0000388TEST_F(WebRtcVideoEngine2Test, SupportsTimestampOffsetHeaderExtension) {
389 std::vector<RtpHeaderExtension> extensions = engine_.rtp_header_extensions();
390 ASSERT_FALSE(extensions.empty());
391 for (size_t i = 0; i < extensions.size(); ++i) {
392 if (extensions[i].uri == kRtpTimestampOffsetHeaderExtension) {
393 EXPECT_EQ(kRtpTimestampOffsetHeaderExtensionDefaultId, extensions[i].id);
394 return;
395 }
396 }
397 FAIL() << "Timestamp offset extension not in header-extension list.";
398}
399
400TEST_F(WebRtcVideoEngine2Test, SupportsAbsoluteSenderTimeHeaderExtension) {
401 std::vector<RtpHeaderExtension> extensions = engine_.rtp_header_extensions();
402 ASSERT_FALSE(extensions.empty());
403 for (size_t i = 0; i < extensions.size(); ++i) {
404 if (extensions[i].uri == kRtpAbsoluteSenderTimeHeaderExtension) {
405 EXPECT_EQ(kRtpAbsoluteSenderTimeHeaderExtensionDefaultId,
406 extensions[i].id);
407 return;
408 }
409 }
410 FAIL() << "Absolute Sender Time extension not in header-extension list.";
411}
412
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000413class WebRtcVideoChannel2BaseTest
414 : public VideoMediaChannelTest<WebRtcVideoEngine2, WebRtcVideoChannel2> {
415 protected:
416 virtual cricket::VideoCodec DefaultCodec() OVERRIDE { return kVp8Codec; }
417 typedef VideoMediaChannelTest<WebRtcVideoEngine2, WebRtcVideoChannel2> Base;
418};
419
420// TODO(pbos): Fix WebRtcVideoEngine2BaseTest, where we want CheckCoInitialize.
421#if 0
422// TODO(juberti): Figure out why ViE is munging the COM refcount.
423#ifdef WIN32
424TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_CheckCoInitialize) {
425 Base::CheckCoInitialize();
426}
427#endif
428#endif
429
430TEST_F(WebRtcVideoChannel2BaseTest, SetSend) { Base::SetSend(); }
431
432TEST_F(WebRtcVideoChannel2BaseTest, SetSendWithoutCodecs) {
433 Base::SetSendWithoutCodecs();
434}
435
436TEST_F(WebRtcVideoChannel2BaseTest, SetSendSetsTransportBufferSizes) {
437 Base::SetSendSetsTransportBufferSizes();
438}
439
440// TODO(juberti): Fix this test to tolerate missing stats.
441TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_GetStats) { Base::GetStats(); }
442
443// TODO(juberti): Fix this test to tolerate missing stats.
444TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_GetStatsMultipleRecvStreams) {
445 Base::GetStatsMultipleRecvStreams();
446}
447
448TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_GetStatsMultipleSendStreams) {
449 Base::GetStatsMultipleSendStreams();
450}
451
452TEST_F(WebRtcVideoChannel2BaseTest, SetSendBandwidth) {
453 Base::SetSendBandwidth();
454}
455TEST_F(WebRtcVideoChannel2BaseTest, SetSendSsrc) { Base::SetSendSsrc(); }
456TEST_F(WebRtcVideoChannel2BaseTest, SetSendSsrcAfterSetCodecs) {
457 Base::SetSendSsrcAfterSetCodecs();
458}
459
460TEST_F(WebRtcVideoChannel2BaseTest, SetRenderer) { Base::SetRenderer(); }
461
462TEST_F(WebRtcVideoChannel2BaseTest, AddRemoveRecvStreams) {
463 Base::AddRemoveRecvStreams();
464}
465
466TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_AddRemoveRecvStreamAndRender) {
467 Base::AddRemoveRecvStreamAndRender();
468}
469
470TEST_F(WebRtcVideoChannel2BaseTest, AddRemoveRecvStreamsNoConference) {
471 Base::AddRemoveRecvStreamsNoConference();
472}
473
474TEST_F(WebRtcVideoChannel2BaseTest, AddRemoveSendStreams) {
475 Base::AddRemoveSendStreams();
476}
477
478TEST_F(WebRtcVideoChannel2BaseTest, SimulateConference) {
479 Base::SimulateConference();
480}
481
482TEST_F(WebRtcVideoChannel2BaseTest, AddRemoveCapturer) {
483 Base::AddRemoveCapturer();
484}
485
486TEST_F(WebRtcVideoChannel2BaseTest, RemoveCapturerWithoutAdd) {
487 Base::RemoveCapturerWithoutAdd();
488}
489
490TEST_F(WebRtcVideoChannel2BaseTest, AddRemoveCapturerMultipleSources) {
491 Base::AddRemoveCapturerMultipleSources();
492}
493
494// TODO(pbos): Figure out why this fails so often.
495TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_HighAspectHighHeightCapturer) {
496 Base::HighAspectHighHeightCapturer();
497}
498
499TEST_F(WebRtcVideoChannel2BaseTest, RejectEmptyStreamParams) {
500 Base::RejectEmptyStreamParams();
501}
502
503TEST_F(WebRtcVideoChannel2BaseTest, AdaptResolution16x10) {
504 Base::AdaptResolution16x10();
505}
506
507TEST_F(WebRtcVideoChannel2BaseTest, AdaptResolution4x3) {
508 Base::AdaptResolution4x3();
509}
510
511TEST_F(WebRtcVideoChannel2BaseTest, MuteStream) { Base::MuteStream(); }
512
513TEST_F(WebRtcVideoChannel2BaseTest, MultipleSendStreams) {
514 Base::MultipleSendStreams();
515}
516
517// TODO(juberti): Restore this test once we support sending 0 fps.
518TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_AdaptDropAllFrames) {
519 Base::AdaptDropAllFrames();
520}
521// TODO(juberti): Understand why we get decode errors on this test.
522TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_AdaptFramerate) {
523 Base::AdaptFramerate();
524}
525
526TEST_F(WebRtcVideoChannel2BaseTest, SetSendStreamFormat0x0) {
527 Base::SetSendStreamFormat0x0();
528}
529
530// TODO(zhurunz): Fix the flakey test.
531TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_SetSendStreamFormat) {
532 Base::SetSendStreamFormat();
533}
534
535TEST_F(WebRtcVideoChannel2BaseTest, TwoStreamsSendAndReceive) {
536 Base::TwoStreamsSendAndReceive(kVp8Codec);
537}
538
539TEST_F(WebRtcVideoChannel2BaseTest, TwoStreamsReUseFirstStream) {
540 Base::TwoStreamsReUseFirstStream(kVp8Codec);
541}
542
543class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test {
544 public:
545 virtual void SetUp() OVERRIDE {
546 channel_.reset(engine_.CreateChannel(NULL));
547 fake_channel_ = factory_.GetFakeChannel(channel_.get());
548 last_ssrc_ = 123;
549 ASSERT_TRUE(fake_channel_ != NULL)
550 << "Channel not created through factory.";
551 }
552
553 protected:
554 FakeVideoSendStream* AddSendStream() {
555 return AddSendStream(StreamParams::CreateLegacy(last_ssrc_++));
556 }
557
558 FakeVideoSendStream* AddSendStream(const StreamParams& sp) {
559 size_t num_streams =
560 fake_channel_->GetFakeCall()->GetVideoSendStreams().size();
561 EXPECT_TRUE(channel_->AddSendStream(sp));
562 std::vector<FakeVideoSendStream*> streams =
563 fake_channel_->GetFakeCall()->GetVideoSendStreams();
564 EXPECT_EQ(num_streams + 1, streams.size());
565 return streams[streams.size() - 1];
566 }
567
568 std::vector<FakeVideoSendStream*> GetFakeSendStreams() {
569 return fake_channel_->GetFakeCall()->GetVideoSendStreams();
570 }
571
572 FakeVideoReceiveStream* AddRecvStream() {
573 return AddRecvStream(StreamParams::CreateLegacy(last_ssrc_++));
574 }
575
576 FakeVideoReceiveStream* AddRecvStream(const StreamParams& sp) {
577 size_t num_streams =
578 fake_channel_->GetFakeCall()->GetVideoReceiveStreams().size();
579 EXPECT_TRUE(channel_->AddRecvStream(sp));
580 std::vector<FakeVideoReceiveStream*> streams =
581 fake_channel_->GetFakeCall()->GetVideoReceiveStreams();
582 EXPECT_EQ(num_streams + 1, streams.size());
583 return streams[streams.size() - 1];
584 }
585
586 void SetSendCodecsShouldWorkForBitrates(const char* min_bitrate,
587 const char* max_bitrate) {
588 std::vector<VideoCodec> codecs;
589 codecs.push_back(kVp8Codec);
590 codecs[0].params[kCodecParamMinBitrate] = min_bitrate;
591 codecs[0].params[kCodecParamMaxBitrate] = max_bitrate;
592 EXPECT_TRUE(channel_->SetSendCodecs(codecs));
593
594 FakeVideoSendStream* stream = AddSendStream();
595
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +0000596 std::vector<webrtc::VideoStream> video_streams = stream->GetVideoStreams();
597 ASSERT_EQ(1u, video_streams.size());
598 EXPECT_EQ(atoi(min_bitrate), video_streams.back().min_bitrate_bps / 1000);
599 EXPECT_EQ(atoi(max_bitrate), video_streams.back().max_bitrate_bps / 1000);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000600
601 VideoCodec codec;
602 EXPECT_TRUE(channel_->GetSendCodec(&codec));
603 EXPECT_EQ(min_bitrate, codec.params[kCodecParamMinBitrate]);
604 EXPECT_EQ(max_bitrate, codec.params[kCodecParamMaxBitrate]);
605 }
606
607 void ExpectEqualCodecs(const VideoCodec video_codec,
608 const webrtc::VideoCodec& webrtc_codec) {
609 EXPECT_STREQ(video_codec.name.c_str(), webrtc_codec.plName);
610 EXPECT_EQ(video_codec.id, webrtc_codec.plType);
611 EXPECT_EQ(video_codec.width, webrtc_codec.width);
612 EXPECT_EQ(video_codec.height, webrtc_codec.height);
613 EXPECT_EQ(video_codec.framerate, webrtc_codec.maxFramerate);
614 }
pbos@webrtc.org587ef602014-06-16 17:32:02 +0000615
616 void TestSetSendRtpHeaderExtensions(const std::string& cricket_ext,
617 const std::string& webrtc_ext) {
618 // Enable extension.
619 const int id = 1;
620 std::vector<cricket::RtpHeaderExtension> extensions;
621 extensions.push_back(cricket::RtpHeaderExtension(cricket_ext, id));
622 EXPECT_TRUE(channel_->SetSendRtpHeaderExtensions(extensions));
623
624 FakeVideoSendStream* send_stream =
625 AddSendStream(cricket::StreamParams::CreateLegacy(123));
626
627 // Verify the send extension id.
628 ASSERT_EQ(1u, send_stream->GetConfig().rtp.extensions.size());
629 EXPECT_EQ(id, send_stream->GetConfig().rtp.extensions[0].id);
630 EXPECT_EQ(webrtc_ext, send_stream->GetConfig().rtp.extensions[0].name);
631 // Verify call with same set of extensions returns true.
632 EXPECT_TRUE(channel_->SetSendRtpHeaderExtensions(extensions));
633 // Verify that SetSendRtpHeaderExtensions doesn't implicitly add them for
634 // receivers.
635 EXPECT_TRUE(AddRecvStream(cricket::StreamParams::CreateLegacy(123))
636 ->GetConfig()
637 .rtp.extensions.empty());
638
639 // Remove the extension id, verify that this doesn't reset extensions as
640 // they should be set before creating channels.
641 std::vector<cricket::RtpHeaderExtension> empty_extensions;
642 EXPECT_TRUE(channel_->SetSendRtpHeaderExtensions(empty_extensions));
643 EXPECT_FALSE(send_stream->GetConfig().rtp.extensions.empty());
644 }
645
646 void TestSetRecvRtpHeaderExtensions(const std::string& cricket_ext,
647 const std::string& webrtc_ext) {
648 // Enable extension.
649 const int id = 1;
650 std::vector<cricket::RtpHeaderExtension> extensions;
651 extensions.push_back(cricket::RtpHeaderExtension(cricket_ext, id));
652 EXPECT_TRUE(channel_->SetRecvRtpHeaderExtensions(extensions));
653
654 FakeVideoReceiveStream* recv_stream =
655 AddRecvStream(cricket::StreamParams::CreateLegacy(123));
656
657 // Verify the recv extension id.
658 ASSERT_EQ(1u, recv_stream->GetConfig().rtp.extensions.size());
659 EXPECT_EQ(id, recv_stream->GetConfig().rtp.extensions[0].id);
660 EXPECT_EQ(webrtc_ext, recv_stream->GetConfig().rtp.extensions[0].name);
661 // Verify call with same set of extensions returns true.
662 EXPECT_TRUE(channel_->SetRecvRtpHeaderExtensions(extensions));
663 // Verify that SetRecvRtpHeaderExtensions doesn't implicitly add them for
664 // senders.
665 EXPECT_TRUE(AddSendStream(cricket::StreamParams::CreateLegacy(123))
666 ->GetConfig()
667 .rtp.extensions.empty());
668
669 // Remove the extension id, verify that this doesn't reset extensions as
670 // they should be set before creating channels.
671 std::vector<cricket::RtpHeaderExtension> empty_extensions;
672 EXPECT_TRUE(channel_->SetSendRtpHeaderExtensions(empty_extensions));
673 EXPECT_FALSE(recv_stream->GetConfig().rtp.extensions.empty());
674 }
675
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000676 talk_base::scoped_ptr<VideoMediaChannel> channel_;
677 FakeWebRtcVideoChannel2* fake_channel_;
678 uint32 last_ssrc_;
679};
680
681TEST_F(WebRtcVideoChannel2Test, DISABLED_MaxBitrateResetsWithConferenceMode) {
682 FAIL() << "Not implemented."; // TODO(pbos): Implement.
683}
684
685TEST_F(WebRtcVideoChannel2Test, DISABLED_StartSendBitrate) {
686 // TODO(pbos): Is this test testing vie_ ? this is confusing. No API to set
687 // start send bitrate from outside? Add defaults here that should be kept?
688 std::vector<cricket::VideoCodec> codec_list;
689 codec_list.push_back(kVp8Codec);
690 EXPECT_TRUE(channel_->SetSendCodecs(codec_list));
691 const unsigned int kVideoMinSendBitrateKbps = 50;
692 const unsigned int kVideoTargetSendBitrateKbps = 300;
693 const unsigned int kVideoMaxSendBitrateKbps = 2000;
694 FakeVideoSendStream* stream = AddSendStream();
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +0000695 std::vector<webrtc::VideoStream> video_streams = stream->GetVideoStreams();
696 ASSERT_EQ(1u, video_streams.size());
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000697 EXPECT_EQ(kVideoMinSendBitrateKbps,
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +0000698 video_streams.back().min_bitrate_bps / 1000);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000699 EXPECT_EQ(kVideoTargetSendBitrateKbps,
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +0000700 video_streams.back().target_bitrate_bps / 1000);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000701 EXPECT_EQ(kVideoMaxSendBitrateKbps,
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +0000702 video_streams.back().max_bitrate_bps / 1000);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000703#if 0
704 // TODO(pbos): un-#if
705 VerifyVP8SendCodec(send_channel, kVP8Codec.width, kVP8Codec.height, 0,
706 kVideoMaxSendBitrateKbps, kVideoMinSendBitrateKbps,
707 kVideoDefaultStartSendBitrateKbps);
708 EXPECT_EQ(0, vie_.StartSend(send_channel));
709
710 // Increase the send bitrate and verify it is used as start bitrate.
711 const unsigned int kVideoSendBitrateBps = 768000;
712 vie_.SetSendBitrates(send_channel, kVideoSendBitrateBps, 0, 0);
713 EXPECT_TRUE(channel_->SetSendCodecs(codec_list));
714 VerifyVP8SendCodec(send_channel, kVP8Codec.width, kVP8Codec.height, 0,
715 kVideoMaxSendBitrateKbps, kVideoMinSendBitrateKbps,
716 kVideoSendBitrateBps / 1000);
717
718 // Never set a start bitrate higher than the max bitrate.
719 vie_.SetSendBitrates(send_channel, kVideoMaxSendBitrateKbps + 500, 0, 0);
720 EXPECT_TRUE(channel_->SetSendCodecs(codec_list));
721 VerifyVP8SendCodec(send_channel, kVP8Codec.width, kVP8Codec.height, 0,
722 kVideoMaxSendBitrateKbps, kVideoMinSendBitrateKbps,
723 kVideoDefaultStartSendBitrateKbps);
724
725 // Use the default start bitrate if the send bitrate is lower.
726 vie_.SetSendBitrates(send_channel, kVideoDefaultStartSendBitrateKbps - 50, 0,
727 0);
728 EXPECT_TRUE(channel_->SetSendCodecs(codec_list));
729 VerifyVP8SendCodec(send_channel, kVP8Codec.width, kVP8Codec.height, 0,
730 kVideoMaxSendBitrateKbps, kVideoMinSendBitrateKbps,
731 kVideoDefaultStartSendBitrateKbps);
732#endif
733}
734
735TEST_F(WebRtcVideoChannel2Test, DISABLED_RtcpEnabled) {
736 // Note(pbos): This is a receiver-side setting, dumbo.
737 FAIL() << "Not implemented."; // TODO(pbos): Implement.
738}
739
740TEST_F(WebRtcVideoChannel2Test, DISABLED_KeyFrameRequestEnabled) {
741 FAIL() << "Not implemented."; // TODO(pbos): Implement.
742}
743
744TEST_F(WebRtcVideoChannel2Test, RembIsEnabledByDefault) {
745 FakeVideoReceiveStream* stream = AddRecvStream();
746 EXPECT_TRUE(stream->GetConfig().rtp.remb);
747}
748
749TEST_F(WebRtcVideoChannel2Test, DISABLED_RembEnabledOnReceiveChannels) {
750 FAIL() << "Not implemented."; // TODO(pbos): Implement.
751}
752
pbos@webrtc.orge322a172014-06-13 11:47:28 +0000753TEST_F(WebRtcVideoChannel2Test, RecvStreamWithSimAndRtx) {
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000754 EXPECT_TRUE(channel_->SetSendCodecs(engine_.codecs()));
755 EXPECT_TRUE(channel_->SetSend(true));
756 cricket::VideoOptions options;
757 options.conference_mode.Set(true);
758 EXPECT_TRUE(channel_->SetOptions(options));
759
760 // Send side.
761 const std::vector<uint32> ssrcs = MAKE_VECTOR(kSsrcs1);
762 const std::vector<uint32> rtx_ssrcs = MAKE_VECTOR(kRtxSsrcs1);
763 FakeVideoSendStream* send_stream = AddSendStream(
764 cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs));
765
766 ASSERT_EQ(rtx_ssrcs.size(), send_stream->GetConfig().rtp.rtx.ssrcs.size());
767 for (size_t i = 0; i < rtx_ssrcs.size(); ++i)
768 EXPECT_EQ(rtx_ssrcs[i], send_stream->GetConfig().rtp.rtx.ssrcs[i]);
769
770 // Receiver side.
771 FakeVideoReceiveStream* recv_stream = AddRecvStream(
772 cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs));
773 ASSERT_GT(recv_stream->GetConfig().rtp.rtx.size(), 0u)
774 << "No SSRCs for RTX configured by AddRecvStream.";
775 ASSERT_EQ(1u, recv_stream->GetConfig().rtp.rtx.size())
776 << "This test only works with one receive codec. Please update the test.";
777 EXPECT_EQ(rtx_ssrcs[0],
778 recv_stream->GetConfig().rtp.rtx.begin()->second.ssrc);
779 // TODO(pbos): Make sure we set the RTX for correct payloads etc.
780}
781
pbos@webrtc.orge322a172014-06-13 11:47:28 +0000782TEST_F(WebRtcVideoChannel2Test, RecvStreamWithRtx) {
783 // Setup one channel with an associated RTX stream.
784 cricket::StreamParams params =
785 cricket::StreamParams::CreateLegacy(kSsrcs1[0]);
786 params.AddFidSsrc(kSsrcs1[0], kRtxSsrcs1[0]);
787 FakeVideoReceiveStream* recv_stream = AddRecvStream(params);
788 ASSERT_EQ(1u, recv_stream->GetConfig().rtp.rtx.size());
789 EXPECT_EQ(kRtxSsrcs1[0],
790 recv_stream->GetConfig().rtp.rtx.begin()->second.ssrc);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000791}
792
pbos@webrtc.orge322a172014-06-13 11:47:28 +0000793TEST_F(WebRtcVideoChannel2Test, RecvStreamNoRtx) {
794 // Setup one channel without an associated RTX stream.
795 cricket::StreamParams params =
796 cricket::StreamParams::CreateLegacy(kSsrcs1[0]);
797 FakeVideoReceiveStream* recv_stream = AddRecvStream(params);
798 ASSERT_TRUE(recv_stream->GetConfig().rtp.rtx.empty());
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000799}
800
pbos@webrtc.org587ef602014-06-16 17:32:02 +0000801TEST_F(WebRtcVideoChannel2Test, NoHeaderExtesionsByDefault) {
802 FakeVideoSendStream* send_stream =
803 AddSendStream(cricket::StreamParams::CreateLegacy(kSsrcs1[0]));
804 ASSERT_TRUE(send_stream->GetConfig().rtp.extensions.empty());
805
806 FakeVideoReceiveStream* recv_stream =
807 AddRecvStream(cricket::StreamParams::CreateLegacy(kSsrcs1[0]));
808 ASSERT_TRUE(recv_stream->GetConfig().rtp.extensions.empty());
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000809}
810
pbos@webrtc.org587ef602014-06-16 17:32:02 +0000811// Test support for RTP timestamp offset header extension.
812TEST_F(WebRtcVideoChannel2Test, SendRtpTimestampOffsetHeaderExtensions) {
813 TestSetSendRtpHeaderExtensions(kRtpTimestampOffsetHeaderExtension,
814 webrtc::RtpExtension::kTOffset);
815}
816TEST_F(WebRtcVideoChannel2Test, RecvRtpTimestampOffsetHeaderExtensions) {
817 TestSetRecvRtpHeaderExtensions(kRtpTimestampOffsetHeaderExtension,
818 webrtc::RtpExtension::kTOffset);
819}
820
821// Test support for absolute send time header extension.
822TEST_F(WebRtcVideoChannel2Test, SendAbsoluteSendTimeHeaderExtensions) {
823 TestSetSendRtpHeaderExtensions(kRtpAbsoluteSenderTimeHeaderExtension,
824 webrtc::RtpExtension::kAbsSendTime);
825}
826TEST_F(WebRtcVideoChannel2Test, RecvAbsoluteSendTimeHeaderExtensions) {
827 TestSetRecvRtpHeaderExtensions(kRtpAbsoluteSenderTimeHeaderExtension,
828 webrtc::RtpExtension::kAbsSendTime);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000829}
830
831TEST_F(WebRtcVideoChannel2Test, DISABLED_LeakyBucketTest) {
832 FAIL() << "Not implemented."; // TODO(pbos): Implement.
833}
834
835TEST_F(WebRtcVideoChannel2Test, DISABLED_BufferedModeLatency) {
836 FAIL() << "Not implemented."; // TODO(pbos): Implement.
837}
838
839TEST_F(WebRtcVideoChannel2Test, DISABLED_AdditiveVideoOptions) {
840 FAIL() << "Not implemented."; // TODO(pbos): Implement.
841}
842
843TEST_F(WebRtcVideoChannel2Test, AddRecvStreamOnlyUsesOneReceiveStream) {
844 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(1)));
845 EXPECT_EQ(1u, fake_channel_->GetFakeCall()->GetVideoReceiveStreams().size());
846}
847
848TEST_F(WebRtcVideoChannel2Test, DISABLED_NoRembChangeAfterAddRecvStream) {
849 FAIL() << "Not implemented."; // TODO(pbos): Implement.
850}
851
852TEST_F(WebRtcVideoChannel2Test, DISABLED_RembOnOff) {
853 FAIL() << "Not implemented."; // TODO(pbos): Implement.
854}
855
pbos@webrtc.orgf99c2f22014-06-13 12:27:38 +0000856TEST_F(WebRtcVideoChannel2Test, NackIsEnabledByDefault) {
857 VerifyCodecHasDefaultFeedbackParams(default_codec_);
858
pbos@webrtc.org19864742014-05-30 07:35:47 +0000859 EXPECT_TRUE(channel_->SetSendCodecs(engine_.codecs()));
860 EXPECT_TRUE(channel_->SetSend(true));
861
862 // Send side.
863 FakeVideoSendStream* send_stream =
864 AddSendStream(cricket::StreamParams::CreateLegacy(1));
865 EXPECT_GT(send_stream->GetConfig().rtp.nack.rtp_history_ms, 0);
866
867 // Receiver side.
868 FakeVideoReceiveStream* recv_stream =
869 AddRecvStream(cricket::StreamParams::CreateLegacy(1));
870 EXPECT_GT(recv_stream->GetConfig().rtp.nack.rtp_history_ms, 0);
871
872 // Nack history size should match between sender and receiver.
873 EXPECT_EQ(send_stream->GetConfig().rtp.nack.rtp_history_ms,
874 recv_stream->GetConfig().rtp.nack.rtp_history_ms);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000875}
876
pbos@webrtc.orgf99c2f22014-06-13 12:27:38 +0000877TEST_F(WebRtcVideoChannel2Test, NackCanBeDisabled) {
878 std::vector<VideoCodec> codecs;
879 codecs.push_back(kVp8Codec);
880
881 // Send side.
882 ASSERT_TRUE(channel_->SetSendCodecs(codecs));
883 FakeVideoSendStream* send_stream =
884 AddSendStream(cricket::StreamParams::CreateLegacy(1));
885 EXPECT_EQ(0, send_stream->GetConfig().rtp.nack.rtp_history_ms);
886
887 // Receiver side.
888 ASSERT_TRUE(channel_->SetRecvCodecs(codecs));
889 FakeVideoReceiveStream* recv_stream =
890 AddRecvStream(cricket::StreamParams::CreateLegacy(1));
891 EXPECT_EQ(0, recv_stream->GetConfig().rtp.nack.rtp_history_ms);
892}
893
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000894TEST_F(WebRtcVideoChannel2Test, DISABLED_VideoProtectionInterop) {
895 FAIL() << "Not implemented."; // TODO(pbos): Implement.
896}
897
898TEST_F(WebRtcVideoChannel2Test, DISABLED_VideoProtectionInteropReversed) {
899 FAIL() << "Not implemented."; // TODO(pbos): Implement.
900}
901
902TEST_F(WebRtcVideoChannel2Test, DISABLED_HybridNackFecConference) {
903 FAIL() << "Not implemented."; // TODO(pbos): Implement.
904}
905
906TEST_F(WebRtcVideoChannel2Test, DISABLED_AddRemoveRecvStreamConference) {
907 FAIL() << "Not implemented."; // TODO(pbos): Implement.
908}
909
910TEST_F(WebRtcVideoChannel2Test, DISABLED_SetRender) {
911 FAIL() << "Not implemented."; // TODO(pbos): Implement.
912}
913
914TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthAuto) {
915 FAIL() << "Not implemented."; // TODO(pbos): Implement.
916}
917
918TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthAutoCapped) {
919 FAIL() << "Not implemented."; // TODO(pbos): Implement.
920}
921
922TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthFixed) {
923 FAIL() << "Not implemented."; // TODO(pbos): Implement.
924}
925
926TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthInConference) {
927 FAIL() << "Not implemented."; // TODO(pbos): Implement.
928}
929
930TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthScreencast) {
931 FAIL() << "Not implemented."; // TODO(pbos): Implement.
932}
933
934TEST_F(WebRtcVideoChannel2Test, DISABLED_SetSendSsrcAndCname) {
935 FAIL() << "Not implemented."; // TODO(pbos): Implement.
936}
937
938TEST_F(WebRtcVideoChannel2Test,
939 DISABLED_SetSendSsrcAfterCreatingReceiveChannel) {
940 FAIL() << "Not implemented."; // TODO(pbos): Implement.
941}
942
943TEST_F(WebRtcVideoChannel2Test, DISABLED_SetOptionsWithDenoising) {
944 FAIL() << "Not implemented."; // TODO(pbos): Implement.
945}
946
947TEST_F(WebRtcVideoChannel2Test, DISABLED_MultipleSendStreamsWithOneCapturer) {
948 FAIL() << "Not implemented."; // TODO(pbos): Implement.
949}
950
951TEST_F(WebRtcVideoChannel2Test, DISABLED_DISABLED_SendReceiveBitratesStats) {
952 FAIL() << "Not implemented."; // TODO(pbos): Implement.
953}
954
955TEST_F(WebRtcVideoChannel2Test, DISABLED_TestSetAdaptInputToCpuUsage) {
956 FAIL() << "Not implemented."; // TODO(pbos): Implement.
957}
958
959TEST_F(WebRtcVideoChannel2Test, DISABLED_TestSetCpuThreshold) {
960 FAIL() << "Not implemented."; // TODO(pbos): Implement.
961}
962
963TEST_F(WebRtcVideoChannel2Test, DISABLED_TestSetInvalidCpuThreshold) {
964 FAIL() << "Not implemented."; // TODO(pbos): Implement.
965}
966
967TEST_F(WebRtcVideoChannel2Test, DISABLED_WebRtcShouldLog) {
968 FAIL() << "Not implemented."; // TODO(pbos): Implement.
969}
970
971TEST_F(WebRtcVideoChannel2Test, DISABLED_WebRtcShouldNotLog) {
972 FAIL() << "Not implemented."; // TODO(pbos): Implement.
973}
974
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000975TEST_F(WebRtcVideoChannel2Test, SetDefaultSendCodecs) {
pbos@webrtc.org9fbb7172014-06-13 09:34:13 +0000976 ASSERT_TRUE(channel_->SetSendCodecs(engine_.codecs()));
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000977
978 VideoCodec codec;
979 EXPECT_TRUE(channel_->GetSendCodec(&codec));
pbos@webrtc.org9fbb7172014-06-13 09:34:13 +0000980 EXPECT_TRUE(codec.Matches(engine_.codecs()[0]));
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000981
982 // Using a RTX setup to verify that the default RTX payload type is good.
983 const std::vector<uint32> ssrcs = MAKE_VECTOR(kSsrcs1);
984 const std::vector<uint32> rtx_ssrcs = MAKE_VECTOR(kRtxSsrcs1);
985 FakeVideoSendStream* stream = AddSendStream(
986 cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs));
987 webrtc::VideoSendStream::Config config = stream->GetConfig();
988 // TODO(pbos): Replace ExpectEqualCodecs.
pbos@webrtc.org9fbb7172014-06-13 09:34:13 +0000989 // ExpectEqualCodecs(engine_.codecs()[0], config.codec);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000990
991 // Make sure NACK and FEC are enabled on the correct payload types.
992 EXPECT_EQ(1000, config.rtp.nack.rtp_history_ms);
993 EXPECT_EQ(default_ulpfec_codec_.id, config.rtp.fec.ulpfec_payload_type);
994 EXPECT_EQ(default_red_codec_.id, config.rtp.fec.red_payload_type);
pbos@webrtc.org269605c2014-06-26 08:49:03 +0000995
996 EXPECT_EQ(1u, config.rtp.rtx.ssrcs.size());
997 EXPECT_EQ(kRtxSsrcs1[0], config.rtp.rtx.ssrcs[0]);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000998 EXPECT_EQ(static_cast<int>(default_rtx_codec_.id),
999 config.rtp.rtx.payload_type);
1000 // TODO(juberti): Check RTCP, PLI, TMMBR.
1001}
1002
1003TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithoutFec) {
1004 std::vector<VideoCodec> codecs;
1005 codecs.push_back(kVp8Codec);
1006 ASSERT_TRUE(channel_->SetSendCodecs(codecs));
1007
1008 FakeVideoSendStream* stream = AddSendStream();
1009 webrtc::VideoSendStream::Config config = stream->GetConfig();
1010
1011 EXPECT_EQ(-1, config.rtp.fec.ulpfec_payload_type);
1012 EXPECT_EQ(-1, config.rtp.fec.red_payload_type);
1013}
1014
1015TEST_F(WebRtcVideoChannel2Test,
pbos@webrtc.org269605c2014-06-26 08:49:03 +00001016 SetSendCodecRejectsRtxWithoutAssociatedPayloadType) {
1017 std::vector<VideoCodec> codecs;
1018 cricket::VideoCodec rtx_codec(96, "rtx", 0, 0, 0, 0);
1019 codecs.push_back(rtx_codec);
1020 EXPECT_FALSE(channel_->SetSendCodecs(codecs))
1021 << "RTX codec without associated payload type should be rejected.";
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +00001022}
1023
1024TEST_F(WebRtcVideoChannel2Test,
pbos@webrtc.org269605c2014-06-26 08:49:03 +00001025 SetSendCodecRejectsRtxWithoutMatchingVideoCodec) {
1026 std::vector<VideoCodec> codecs;
1027 cricket::VideoCodec rtx_codec =
1028 cricket::VideoCodec::CreateRtxCodec(96, kVp8Codec.id);
1029 codecs.push_back(kVp8Codec);
1030 codecs.push_back(rtx_codec);
1031 ASSERT_TRUE(channel_->SetSendCodecs(codecs));
1032
1033 cricket::VideoCodec rtx_codec2 =
1034 cricket::VideoCodec::CreateRtxCodec(96, kVp8Codec.id + 1);
1035 codecs.pop_back();
1036 codecs.push_back(rtx_codec2);
1037 EXPECT_FALSE(channel_->SetSendCodecs(codecs))
1038 << "RTX without matching video codec should be rejected.";
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +00001039}
1040
pbos@webrtc.org269605c2014-06-26 08:49:03 +00001041TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithoutFecDisablesFec) {
1042 std::vector<VideoCodec> codecs;
1043 codecs.push_back(kVp8Codec);
1044 codecs.push_back(kUlpfecCodec);
1045 ASSERT_TRUE(channel_->SetSendCodecs(codecs));
1046
1047 FakeVideoSendStream* stream = AddSendStream();
1048 webrtc::VideoSendStream::Config config = stream->GetConfig();
1049
1050 EXPECT_EQ(kUlpfecCodec.id, config.rtp.fec.ulpfec_payload_type);
1051
1052 codecs.pop_back();
1053 ASSERT_TRUE(channel_->SetSendCodecs(codecs));
1054 stream = fake_channel_->GetFakeCall()->GetVideoSendStreams()[0];
1055 ASSERT_TRUE(stream != NULL);
1056 config = stream->GetConfig();
1057 EXPECT_EQ(-1, config.rtp.fec.ulpfec_payload_type)
1058 << "SetSendCodec without FEC should disable current FEC.";
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +00001059}
1060
1061TEST_F(WebRtcVideoChannel2Test, DISABLED_SetSendCodecsChangesExistingStreams) {
1062 FAIL(); // TODO(pbos): Implement, make sure that it's changing running
1063 // streams. Should it?
1064}
1065
1066TEST_F(WebRtcVideoChannel2Test,
1067 DISABLED_ConstrainsSetCodecsAccordingToEncoderConfig) {
1068 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1069}
1070
1071TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithMinMaxBitrate) {
1072 SetSendCodecsShouldWorkForBitrates("10", "20");
1073}
1074
1075TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectsMaxLessThanMinBitrate) {
pbos@webrtc.org9fbb7172014-06-13 09:34:13 +00001076 std::vector<VideoCodec> video_codecs = engine_.codecs();
1077 video_codecs[0].params[kCodecParamMinBitrate] = "30";
1078 video_codecs[0].params[kCodecParamMaxBitrate] = "20";
1079 EXPECT_FALSE(channel_->SetSendCodecs(video_codecs));
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +00001080}
1081
1082TEST_F(WebRtcVideoChannel2Test, SetSendCodecsAcceptLargeMinMaxBitrate) {
1083 SetSendCodecsShouldWorkForBitrates("1000", "2000");
1084}
1085
1086TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithMaxQuantization) {
1087 static const char* kMaxQuantization = "21";
1088 std::vector<VideoCodec> codecs;
1089 codecs.push_back(kVp8Codec);
1090 codecs[0].params[kCodecParamMaxQuantization] = kMaxQuantization;
1091 EXPECT_TRUE(channel_->SetSendCodecs(codecs));
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +00001092 EXPECT_EQ(static_cast<unsigned int>(atoi(kMaxQuantization)),
1093 AddSendStream()->GetVideoStreams().back().max_qp);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +00001094
1095 VideoCodec codec;
1096 EXPECT_TRUE(channel_->GetSendCodec(&codec));
1097 EXPECT_EQ(kMaxQuantization, codec.params[kCodecParamMaxQuantization]);
1098}
1099
1100TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectBadDimensions) {
1101 std::vector<cricket::VideoCodec> codecs;
1102 codecs.push_back(kVp8Codec);
1103
1104 codecs[0].width = 0;
1105 EXPECT_FALSE(channel_->SetSendCodecs(codecs))
1106 << "Codec set though codec width is zero.";
1107
1108 codecs[0].width = kVp8Codec.width;
1109 codecs[0].height = 0;
1110 EXPECT_FALSE(channel_->SetSendCodecs(codecs))
1111 << "Codec set though codec height is zero.";
1112}
1113
1114TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectBadPayloadTypes) {
1115 // TODO(pbos): Should we only allow the dynamic range?
1116 static const size_t kNumIncorrectPayloads = 4;
1117 static const int kIncorrectPayloads[kNumIncorrectPayloads] = {-2, -1, 128,
1118 129};
1119 std::vector<cricket::VideoCodec> codecs;
1120 codecs.push_back(kVp8Codec);
1121 for (size_t i = 0; i < kNumIncorrectPayloads; ++i) {
1122 int payload_type = kIncorrectPayloads[i];
1123 codecs[0].id = payload_type;
1124 EXPECT_FALSE(channel_->SetSendCodecs(codecs))
1125 << "Bad payload type '" << payload_type << "' accepted.";
1126 }
1127}
1128
1129TEST_F(WebRtcVideoChannel2Test, SetSendCodecsAcceptAllValidPayloadTypes) {
1130 std::vector<cricket::VideoCodec> codecs;
1131 codecs.push_back(kVp8Codec);
1132 for (int payload_type = 0; payload_type <= 127; ++payload_type) {
1133 codecs[0].id = payload_type;
1134 EXPECT_TRUE(channel_->SetSendCodecs(codecs))
1135 << "Payload type '" << payload_type << "' rejected.";
1136 }
1137}
1138
1139TEST_F(WebRtcVideoChannel2Test, DISABLED_ResetVieSendCodecOnNewFrameSize) {
1140 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1141}
1142
1143TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsWithOnlyVp8) {
1144 std::vector<cricket::VideoCodec> codecs;
1145 codecs.push_back(kVp8Codec);
1146 EXPECT_TRUE(channel_->SetRecvCodecs(codecs));
1147}
1148
pbos@webrtc.orge322a172014-06-13 11:47:28 +00001149// Test that we set our inbound RTX codecs properly.
1150TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsWithRtx) {
1151 std::vector<cricket::VideoCodec> codecs;
1152 codecs.push_back(kVp8Codec);
1153 cricket::VideoCodec rtx_codec(96, "rtx", 0, 0, 0, 0);
1154 codecs.push_back(rtx_codec);
1155 EXPECT_FALSE(channel_->SetRecvCodecs(codecs))
1156 << "RTX codec without associated payload should be rejected.";
1157
1158 codecs[1].SetParam("apt", kVp8Codec.id + 1);
1159 EXPECT_FALSE(channel_->SetRecvCodecs(codecs))
1160 << "RTX codec with invalid associated payload type should be rejected.";
1161
1162 codecs[1].SetParam("apt", kVp8Codec.id);
1163 EXPECT_TRUE(channel_->SetRecvCodecs(codecs));
1164
1165 cricket::VideoCodec rtx_codec2(97, "rtx", 0, 0, 0, 0);
1166 rtx_codec2.SetParam("apt", rtx_codec.id);
1167 codecs.push_back(rtx_codec2);
1168
1169 EXPECT_FALSE(channel_->SetRecvCodecs(codecs)) << "RTX codec with another RTX "
1170 "as associated payload type "
1171 "should be rejected.";
1172}
1173
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +00001174TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsDifferentPayloadType) {
1175 std::vector<cricket::VideoCodec> codecs;
1176 codecs.push_back(kVp8Codec);
1177 codecs[0].id = 99;
1178 EXPECT_TRUE(channel_->SetRecvCodecs(codecs));
1179}
1180
1181TEST_F(WebRtcVideoChannel2Test, DISABLED_SetRecvCodecsAcceptDefaultCodecs) {
1182 EXPECT_TRUE(channel_->SetRecvCodecs(engine_.codecs()));
1183 // (I've added this one.) Make sure they propagate down to VideoReceiveStream!
1184 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1185}
1186
1187TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsRejectUnsupportedCodec) {
1188 std::vector<VideoCodec> codecs;
1189 codecs.push_back(kVp8Codec);
1190 codecs.push_back(VideoCodec(101, "WTF3", 640, 400, 30, 0));
1191 EXPECT_FALSE(channel_->SetRecvCodecs(codecs));
1192}
1193
1194// TODO(pbos): Enable VP9 through external codec support
1195TEST_F(WebRtcVideoChannel2Test,
1196 DISABLED_SetRecvCodecsAcceptsMultipleVideoCodecs) {
1197 std::vector<VideoCodec> codecs;
1198 codecs.push_back(kVp8Codec);
1199 codecs.push_back(kVp9Codec);
1200 EXPECT_TRUE(channel_->SetRecvCodecs(codecs));
1201}
1202
1203TEST_F(WebRtcVideoChannel2Test,
1204 DISABLED_SetRecvCodecsSetsFecForAllVideoCodecs) {
1205 std::vector<VideoCodec> codecs;
1206 codecs.push_back(kVp8Codec);
1207 codecs.push_back(kVp9Codec);
1208 EXPECT_TRUE(channel_->SetRecvCodecs(codecs));
1209 FAIL(); // TODO(pbos): Verify that the FEC parameters are set for all codecs.
1210}
1211
pbos@webrtc.org269605c2014-06-26 08:49:03 +00001212TEST_F(WebRtcVideoChannel2Test, DISABLED_SetRecvCodecsWithoutFecDisablesFec) {
1213 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1214}
1215
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +00001216TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectDuplicateFecPayloads) {
1217 std::vector<VideoCodec> codecs;
1218 codecs.push_back(kVp8Codec);
1219 codecs.push_back(kRedCodec);
1220 codecs[1].id = codecs[0].id;
1221 EXPECT_FALSE(channel_->SetRecvCodecs(codecs));
1222}
1223
1224TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsRejectDuplicateCodecPayloads) {
1225 std::vector<VideoCodec> codecs;
1226 codecs.push_back(kVp8Codec);
1227 codecs.push_back(kVp9Codec);
1228 codecs[1].id = codecs[0].id;
1229 EXPECT_FALSE(channel_->SetRecvCodecs(codecs));
1230}
1231
1232TEST_F(WebRtcVideoChannel2Test,
1233 SetRecvCodecsAcceptSameCodecOnMultiplePayloadTypes) {
1234 std::vector<VideoCodec> codecs;
1235 codecs.push_back(kVp8Codec);
1236 codecs.push_back(kVp8Codec);
1237 codecs[1].id += 1;
1238 EXPECT_TRUE(channel_->SetRecvCodecs(codecs));
1239}
1240
1241TEST_F(WebRtcVideoChannel2Test, SendStreamNotSendingByDefault) {
1242 EXPECT_FALSE(AddSendStream()->IsSending());
1243}
1244
1245TEST_F(WebRtcVideoChannel2Test, DISABLED_ReceiveStreamReceivingByDefault) {
1246 // Is this test correct though? Auto-receive? Enable receive on first packet?
1247 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1248}
1249
1250TEST_F(WebRtcVideoChannel2Test, SetSend) {
1251 AddSendStream();
1252 EXPECT_FALSE(channel_->SetSend(true))
1253 << "Channel should not start without codecs.";
1254 EXPECT_TRUE(channel_->SetSend(false))
1255 << "Channel should be stoppable even without set codecs.";
1256
1257 std::vector<cricket::VideoCodec> codecs;
1258 codecs.push_back(kVp8Codec);
1259 channel_->SetSendCodecs(codecs);
1260 std::vector<FakeVideoSendStream*> streams = GetFakeSendStreams();
1261 ASSERT_EQ(1u, streams.size());
1262 FakeVideoSendStream* stream = streams.back();
1263
1264 EXPECT_FALSE(stream->IsSending());
1265
1266 // false->true
1267 EXPECT_TRUE(channel_->SetSend(true));
1268 EXPECT_TRUE(stream->IsSending());
1269 // true->true
1270 EXPECT_TRUE(channel_->SetSend(true));
1271 EXPECT_TRUE(stream->IsSending());
1272 // true->false
1273 EXPECT_TRUE(channel_->SetSend(false));
1274 EXPECT_FALSE(stream->IsSending());
1275 // false->false
1276 EXPECT_TRUE(channel_->SetSend(false));
1277 EXPECT_FALSE(stream->IsSending());
1278
1279 EXPECT_TRUE(channel_->SetSend(true));
1280 FakeVideoSendStream* new_stream = AddSendStream();
1281 EXPECT_TRUE(new_stream->IsSending())
1282 << "Send stream created after SetSend(true) not sending initially.";
1283}
1284
1285TEST_F(WebRtcVideoChannel2Test, DISABLED_SendAndReceiveVp8Vga) {
1286 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1287}
1288
1289TEST_F(WebRtcVideoChannel2Test, DISABLED_SendAndReceiveVp8Qvga) {
1290 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1291}
1292
1293TEST_F(WebRtcVideoChannel2Test, DISABLED_SendAndReceiveH264SvcQqvga) {
1294 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1295}
1296
1297TEST_F(WebRtcVideoChannel2Test, DISABLED_SendManyResizeOnce) {
1298 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1299}
1300
1301TEST_F(WebRtcVideoChannel2Test, DISABLED_SendVp8HdAndReceiveAdaptedVp8Vga) {
1302 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1303}
1304
1305TEST_F(WebRtcVideoChannel2Test, DISABLED_TestSetDscpOptions) {
1306 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1307}
1308
1309TEST_F(WebRtcVideoChannel2Test, DISABLED_SetOptionsWithMaxBitrate) {
1310 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1311}
1312
1313TEST_F(WebRtcVideoChannel2Test, DISABLED_SetOptionsWithLoweredBitrate) {
1314 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1315}
1316
1317TEST_F(WebRtcVideoChannel2Test, DISABLED_SetOptionsSucceedsWhenSending) {
1318 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1319}
1320
1321TEST_F(WebRtcVideoChannel2Test, DISABLED_ResetCodecOnScreencast) {
1322 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1323}
1324
1325TEST_F(WebRtcVideoChannel2Test, DISABLED_DontResetCodecOnSendFrame) {
1326 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1327}
1328
1329TEST_F(WebRtcVideoChannel2Test,
1330 DISABLED_DontRegisterDecoderIfFactoryIsNotGiven) {
1331 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1332}
1333
1334TEST_F(WebRtcVideoChannel2Test, DISABLED_RegisterDecoderIfFactoryIsGiven) {
1335 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1336}
1337
1338TEST_F(WebRtcVideoChannel2Test, DISABLED_DontRegisterDecoderMultipleTimes) {
1339 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1340}
1341
1342TEST_F(WebRtcVideoChannel2Test, DISABLED_DontRegisterDecoderForNonVP8) {
1343 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1344}
1345
1346TEST_F(WebRtcVideoChannel2Test,
1347 DISABLED_DontRegisterEncoderIfFactoryIsNotGiven) {
1348 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1349}
1350
1351TEST_F(WebRtcVideoChannel2Test, DISABLED_RegisterEncoderIfFactoryIsGiven) {
1352 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1353}
1354
1355TEST_F(WebRtcVideoChannel2Test, DISABLED_DontRegisterEncoderMultipleTimes) {
1356 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1357}
1358
1359TEST_F(WebRtcVideoChannel2Test,
1360 DISABLED_RegisterEncoderWithMultipleSendStreams) {
1361 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1362}
1363
1364TEST_F(WebRtcVideoChannel2Test, DISABLED_DontRegisterEncoderForNonVP8) {
1365 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1366}
1367
1368TEST_F(WebRtcVideoChannel2Test, DISABLED_FeedbackParamsForNonVP8) {
1369 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1370}
1371
1372TEST_F(WebRtcVideoChannel2Test, DISABLED_ExternalCodecAddedToTheEnd) {
1373 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1374}
1375
1376TEST_F(WebRtcVideoChannel2Test, DISABLED_ExternalCodecIgnored) {
1377 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1378}
1379
1380TEST_F(WebRtcVideoChannel2Test, DISABLED_UpdateEncoderCodecsAfterSetFactory) {
1381 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1382}
1383
1384TEST_F(WebRtcVideoChannel2Test, DISABLED_OnReadyToSend) {
1385 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1386}
1387
1388TEST_F(WebRtcVideoChannel2Test, DISABLED_CaptureFrameTimestampToNtpTimestamp) {
1389 FAIL() << "Not implemented."; // TODO(pbos): Implement.
1390}
1391} // namespace cricket