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

Side by Side Diff: talk/media/base/videoengine_unittest.h

Issue 1642513002: Delete unused members from VideoOptions (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Suggested comment edits. Created 4 years, 10 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
« no previous file with comments | « talk/media/base/mediachannel.h ('k') | talk/media/webrtc/webrtcvideoengine2.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 EXPECT_FALSE(channel_->AddRecvStream( 1307 EXPECT_FALSE(channel_->AddRecvStream(
1308 cricket::StreamParams::CreateLegacy(new_ssrc))); 1308 cricket::StreamParams::CreateLegacy(new_ssrc)));
1309 1309
1310 EXPECT_TRUE(channel_->SetCapturer(new_ssrc, video_capturer_.get())); 1310 EXPECT_TRUE(channel_->SetCapturer(new_ssrc, video_capturer_.get()));
1311 1311
1312 SendAndReceive(codec); 1312 SendAndReceive(codec);
1313 EXPECT_TRUE(channel_->RemoveSendStream(new_ssrc)); 1313 EXPECT_TRUE(channel_->RemoveSendStream(new_ssrc));
1314 EXPECT_EQ(0u, channel_->GetDefaultSendChannelSsrc()); 1314 EXPECT_EQ(0u, channel_->GetDefaultSendChannelSsrc());
1315 } 1315 }
1316 1316
1317 // Tests that we can send and receive frames with early receive.
1318 void TwoStreamsSendAndUnsignalledRecv(const cricket::VideoCodec& codec) {
1319 cricket::VideoSendParameters parameters;
1320 parameters.options.conference_mode = rtc::Optional<bool>(true);
1321 parameters.options.unsignalled_recv_stream_limit = rtc::Optional<int>(1);
1322 EXPECT_TRUE(channel_->SetSendParameters(parameters));
1323 SetUpSecondStreamWithNoRecv();
1324 // Test sending and receiving on first stream.
1325 Send(codec);
1326 EXPECT_EQ_WAIT(2, NumRtpPackets(), kTimeout);
1327 EXPECT_EQ_WAIT(1, renderer_.num_rendered_frames(), kTimeout);
1328 // The first send is not expected to yield frames, because the ssrc
1329 // is not signalled yet. With unsignalled recv enabled, we will drop frames
1330 // instead of packets.
1331 EXPECT_EQ(0, renderer2_.num_rendered_frames());
1332 // Give a chance for the decoder to process before adding the receiver.
1333 rtc::Thread::Current()->ProcessMessages(100);
1334 // Test sending and receiving on second stream.
1335 EXPECT_TRUE(channel_->AddRecvStream(
1336 cricket::StreamParams::CreateLegacy(kSsrc + 2)));
1337 EXPECT_TRUE(channel_->SetRenderer(kSsrc + 2, &renderer2_));
1338 SendFrame();
1339 EXPECT_EQ_WAIT(2, renderer_.num_rendered_frames(), kTimeout);
1340 EXPECT_EQ(4, NumRtpPackets());
1341 // The second send is expected to yield frame as the ssrc is signalled now.
1342 // Decode should succeed here, though we received the key frame earlier.
1343 // Without early recv, we would have dropped it and decoding would have
1344 // failed.
1345 EXPECT_EQ_WAIT(1, renderer2_.num_rendered_frames(), kTimeout);
1346 }
1347
1348 // Tests that we drop key frames when conference mode is enabled and we
1349 // receive rtp packets on unsignalled streams. Removal of a unsignalled recv
1350 // stream is successful.
1351 void TwoStreamsAddAndRemoveUnsignalledRecv(
1352 const cricket::VideoCodec& codec) {
1353 cricket::VideoOptions vmo;
1354 vmo.conference_mode = rtc::Optional<bool>(true);
1355 vmo.unsignalled_recv_stream_limit = rtc::Optional<int>(1);
1356 EXPECT_TRUE(channel_->SetOptions(vmo));
1357 SetUpSecondStreamWithNoRecv();
1358 // Sending and receiving on first stream.
1359 Send(codec);
1360 EXPECT_EQ_WAIT(2, NumRtpPackets(), kTimeout);
1361 EXPECT_EQ_WAIT(1, renderer_.num_rendered_frames(), kTimeout);
1362 // The first send is not expected to yield frames, because the ssrc
1363 // is no signalled yet. With unsignalled recv enabled, we will drop frames
1364 // instead of packets.
1365 EXPECT_EQ(0, renderer2_.num_rendered_frames());
1366 // Give a chance for the decoder to process before adding the receiver.
1367 rtc::Thread::Current()->ProcessMessages(100);
1368 // Ensure that we can remove the unsignalled recv stream that was created
1369 // when the first video packet with unsignalled recv ssrc is received.
1370 EXPECT_TRUE(channel_->RemoveRecvStream(kSsrc + 2));
1371 }
1372
1373 const rtc::scoped_ptr<webrtc::Call> call_; 1317 const rtc::scoped_ptr<webrtc::Call> call_;
1374 VideoEngineOverride<E> engine_; 1318 VideoEngineOverride<E> engine_;
1375 rtc::scoped_ptr<cricket::FakeVideoCapturer> video_capturer_; 1319 rtc::scoped_ptr<cricket::FakeVideoCapturer> video_capturer_;
1376 rtc::scoped_ptr<cricket::FakeVideoCapturer> video_capturer_2_; 1320 rtc::scoped_ptr<cricket::FakeVideoCapturer> video_capturer_2_;
1377 rtc::scoped_ptr<C> channel_; 1321 rtc::scoped_ptr<C> channel_;
1378 cricket::FakeNetworkInterface network_interface_; 1322 cricket::FakeNetworkInterface network_interface_;
1379 cricket::FakeVideoRenderer renderer_; 1323 cricket::FakeVideoRenderer renderer_;
1380 cricket::VideoMediaChannel::Error media_error_; 1324 cricket::VideoMediaChannel::Error media_error_;
1381 1325
1382 // Used by test cases where 2 streams are run on the same channel. 1326 // Used by test cases where 2 streams are run on the same channel.
1383 cricket::FakeVideoRenderer renderer2_; 1327 cricket::FakeVideoRenderer renderer2_;
1384 }; 1328 };
1385 1329
1386 #endif // TALK_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT 1330 #endif // TALK_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT
OLDNEW
« no previous file with comments | « talk/media/base/mediachannel.h ('k') | talk/media/webrtc/webrtcvideoengine2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698