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

Side by Side Diff: webrtc/media/engine/webrtcvideoengine2_unittest.cc

Issue 2042603002: Movable support for VideoReceiveStream::Config and avoid copies (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add TODO Created 4 years, 6 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 | « webrtc/media/engine/webrtcvideoengine2.cc ('k') | webrtc/test/call_test.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 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 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 10
(...skipping 2610 matching lines...) Expand 10 before | Expand all | Expand 10 after
2621 parameters.codecs[0].id = 99; 2621 parameters.codecs[0].id = 99;
2622 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); 2622 EXPECT_TRUE(channel_->SetRecvParameters(parameters));
2623 } 2623 }
2624 2624
2625 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsAcceptDefaultCodecs) { 2625 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsAcceptDefaultCodecs) {
2626 cricket::VideoRecvParameters parameters; 2626 cricket::VideoRecvParameters parameters;
2627 parameters.codecs = engine_.codecs(); 2627 parameters.codecs = engine_.codecs();
2628 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); 2628 EXPECT_TRUE(channel_->SetRecvParameters(parameters));
2629 2629
2630 FakeVideoReceiveStream* stream = AddRecvStream(); 2630 FakeVideoReceiveStream* stream = AddRecvStream();
2631 webrtc::VideoReceiveStream::Config config = stream->GetConfig(); 2631 const webrtc::VideoReceiveStream::Config& config = stream->GetConfig();
2632 EXPECT_EQ(engine_.codecs()[0].name, config.decoders[0].payload_name); 2632 EXPECT_EQ(engine_.codecs()[0].name, config.decoders[0].payload_name);
2633 EXPECT_EQ(engine_.codecs()[0].id, config.decoders[0].payload_type); 2633 EXPECT_EQ(engine_.codecs()[0].id, config.decoders[0].payload_type);
2634 } 2634 }
2635 2635
2636 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsRejectUnsupportedCodec) { 2636 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsRejectUnsupportedCodec) {
2637 cricket::VideoRecvParameters parameters; 2637 cricket::VideoRecvParameters parameters;
2638 parameters.codecs.push_back(kVp8Codec); 2638 parameters.codecs.push_back(kVp8Codec);
2639 parameters.codecs.push_back(VideoCodec(101, "WTF3", 640, 400, 30)); 2639 parameters.codecs.push_back(VideoCodec(101, "WTF3", 640, 400, 30));
2640 EXPECT_FALSE(channel_->SetRecvParameters(parameters)); 2640 EXPECT_FALSE(channel_->SetRecvParameters(parameters));
2641 } 2641 }
(...skipping 17 matching lines...) Expand all
2659 } 2659 }
2660 2660
2661 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsWithoutFecDisablesFec) { 2661 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsWithoutFecDisablesFec) {
2662 cricket::VideoSendParameters send_parameters; 2662 cricket::VideoSendParameters send_parameters;
2663 send_parameters.codecs.push_back(kVp8Codec); 2663 send_parameters.codecs.push_back(kVp8Codec);
2664 send_parameters.codecs.push_back(kRedCodec); 2664 send_parameters.codecs.push_back(kRedCodec);
2665 send_parameters.codecs.push_back(kUlpfecCodec); 2665 send_parameters.codecs.push_back(kUlpfecCodec);
2666 ASSERT_TRUE(channel_->SetSendParameters(send_parameters)); 2666 ASSERT_TRUE(channel_->SetSendParameters(send_parameters));
2667 2667
2668 FakeVideoReceiveStream* stream = AddRecvStream(); 2668 FakeVideoReceiveStream* stream = AddRecvStream();
2669 webrtc::VideoReceiveStream::Config config = stream->GetConfig();
2670 2669
2671 EXPECT_EQ(kUlpfecCodec.id, config.rtp.fec.ulpfec_payload_type); 2670 EXPECT_EQ(kUlpfecCodec.id, stream->GetConfig().rtp.fec.ulpfec_payload_type);
2672 2671
2673 cricket::VideoRecvParameters recv_parameters; 2672 cricket::VideoRecvParameters recv_parameters;
2674 recv_parameters.codecs.push_back(kVp8Codec); 2673 recv_parameters.codecs.push_back(kVp8Codec);
2675 ASSERT_TRUE(channel_->SetRecvParameters(recv_parameters)); 2674 ASSERT_TRUE(channel_->SetRecvParameters(recv_parameters));
2676 stream = fake_call_->GetVideoReceiveStreams()[0]; 2675 stream = fake_call_->GetVideoReceiveStreams()[0];
2677 ASSERT_TRUE(stream != NULL); 2676 ASSERT_TRUE(stream != NULL);
2678 config = stream->GetConfig(); 2677 EXPECT_EQ(-1, stream->GetConfig().rtp.fec.ulpfec_payload_type)
2679 EXPECT_EQ(-1, config.rtp.fec.ulpfec_payload_type)
2680 << "SetSendCodec without FEC should disable current FEC."; 2678 << "SetSendCodec without FEC should disable current FEC.";
2681 } 2679 }
2682 2680
2683 TEST_F(WebRtcVideoChannel2Test, SetSendParamsWithoutFecDisablesReceivingFec) { 2681 TEST_F(WebRtcVideoChannel2Test, SetSendParamsWithoutFecDisablesReceivingFec) {
2684 FakeVideoReceiveStream* stream = AddRecvStream(); 2682 FakeVideoReceiveStream* stream = AddRecvStream();
2685 webrtc::VideoReceiveStream::Config config = stream->GetConfig(); 2683 EXPECT_EQ(kUlpfecCodec.id, stream->GetConfig().rtp.fec.ulpfec_payload_type);
2686
2687 EXPECT_EQ(kUlpfecCodec.id, config.rtp.fec.ulpfec_payload_type);
2688 2684
2689 cricket::VideoRecvParameters recv_parameters; 2685 cricket::VideoRecvParameters recv_parameters;
2690 recv_parameters.codecs.push_back(kVp8Codec); 2686 recv_parameters.codecs.push_back(kVp8Codec);
2691 recv_parameters.codecs.push_back(kRedCodec); 2687 recv_parameters.codecs.push_back(kRedCodec);
2692 recv_parameters.codecs.push_back(kUlpfecCodec); 2688 recv_parameters.codecs.push_back(kUlpfecCodec);
2693 ASSERT_TRUE(channel_->SetRecvParameters(recv_parameters)); 2689 ASSERT_TRUE(channel_->SetRecvParameters(recv_parameters));
2694 stream = fake_call_->GetVideoReceiveStreams()[0]; 2690 stream = fake_call_->GetVideoReceiveStreams()[0];
2695 ASSERT_TRUE(stream != NULL); 2691 ASSERT_TRUE(stream != NULL);
2696 config = stream->GetConfig(); 2692 EXPECT_EQ(kUlpfecCodec.id, stream->GetConfig().rtp.fec.ulpfec_payload_type)
2697 EXPECT_EQ(kUlpfecCodec.id, config.rtp.fec.ulpfec_payload_type)
2698 << "FEC should be enabled on the recieve stream."; 2693 << "FEC should be enabled on the recieve stream.";
2699 2694
2700 cricket::VideoSendParameters send_parameters; 2695 cricket::VideoSendParameters send_parameters;
2701 send_parameters.codecs.push_back(kVp8Codec); 2696 send_parameters.codecs.push_back(kVp8Codec);
2702 ASSERT_TRUE(channel_->SetSendParameters(send_parameters)); 2697 ASSERT_TRUE(channel_->SetSendParameters(send_parameters));
2703 stream = fake_call_->GetVideoReceiveStreams()[0]; 2698 stream = fake_call_->GetVideoReceiveStreams()[0];
2704 config = stream->GetConfig(); 2699 EXPECT_EQ(-1, stream->GetConfig().rtp.fec.ulpfec_payload_type)
2705 EXPECT_EQ(-1, config.rtp.fec.ulpfec_payload_type)
2706 << "FEC should have been disabled when we know the other side won't do " 2700 << "FEC should have been disabled when we know the other side won't do "
2707 "FEC."; 2701 "FEC.";
2708 2702
2709 send_parameters.codecs.push_back(kRedCodec); 2703 send_parameters.codecs.push_back(kRedCodec);
2710 send_parameters.codecs.push_back(kUlpfecCodec); 2704 send_parameters.codecs.push_back(kUlpfecCodec);
2711 ASSERT_TRUE(channel_->SetSendParameters(send_parameters)); 2705 ASSERT_TRUE(channel_->SetSendParameters(send_parameters));
2712 stream = fake_call_->GetVideoReceiveStreams()[0]; 2706 stream = fake_call_->GetVideoReceiveStreams()[0];
2713 config = stream->GetConfig(); 2707 EXPECT_EQ(kUlpfecCodec.id, stream->GetConfig().rtp.fec.ulpfec_payload_type)
2714 EXPECT_EQ(kUlpfecCodec.id, config.rtp.fec.ulpfec_payload_type)
2715 << "FEC should be enabled on the recieve stream."; 2708 << "FEC should be enabled on the recieve stream.";
2716 } 2709 }
2717 2710
2718 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectDuplicateFecPayloads) { 2711 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectDuplicateFecPayloads) {
2719 cricket::VideoRecvParameters parameters; 2712 cricket::VideoRecvParameters parameters;
2720 parameters.codecs.push_back(kVp8Codec); 2713 parameters.codecs.push_back(kVp8Codec);
2721 parameters.codecs.push_back(kRedCodec); 2714 parameters.codecs.push_back(kRedCodec);
2722 parameters.codecs[1].id = parameters.codecs[0].id; 2715 parameters.codecs[1].id = parameters.codecs[0].id;
2723 EXPECT_FALSE(channel_->SetRecvParameters(parameters)); 2716 EXPECT_FALSE(channel_->SetRecvParameters(parameters));
2724 } 2717 }
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after
3766 } 3759 }
3767 3760
3768 // Test that we normalize send codec format size in simulcast. 3761 // Test that we normalize send codec format size in simulcast.
3769 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { 3762 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) {
3770 cricket::VideoCodec codec(kVp8Codec270p); 3763 cricket::VideoCodec codec(kVp8Codec270p);
3771 codec.width += 1; 3764 codec.width += 1;
3772 codec.height += 1; 3765 codec.height += 1;
3773 VerifySimulcastSettings(codec, 2, 2); 3766 VerifySimulcastSettings(codec, 2, 2);
3774 } 3767 }
3775 } // namespace cricket 3768 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.cc ('k') | webrtc/test/call_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698