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

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: git cl format 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
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 2615 matching lines...) Expand 10 before | Expand all | Expand 10 after
2626 parameters.codecs[0].id = 99; 2626 parameters.codecs[0].id = 99;
2627 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); 2627 EXPECT_TRUE(channel_->SetRecvParameters(parameters));
2628 } 2628 }
2629 2629
2630 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsAcceptDefaultCodecs) { 2630 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsAcceptDefaultCodecs) {
2631 cricket::VideoRecvParameters parameters; 2631 cricket::VideoRecvParameters parameters;
2632 parameters.codecs = engine_.codecs(); 2632 parameters.codecs = engine_.codecs();
2633 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); 2633 EXPECT_TRUE(channel_->SetRecvParameters(parameters));
2634 2634
2635 FakeVideoReceiveStream* stream = AddRecvStream(); 2635 FakeVideoReceiveStream* stream = AddRecvStream();
2636 webrtc::VideoReceiveStream::Config config = stream->GetConfig(); 2636 const webrtc::VideoReceiveStream::Config& config = stream->GetConfig();
2637 EXPECT_EQ(engine_.codecs()[0].name, config.decoders[0].payload_name); 2637 EXPECT_EQ(engine_.codecs()[0].name, config.decoders[0].payload_name);
2638 EXPECT_EQ(engine_.codecs()[0].id, config.decoders[0].payload_type); 2638 EXPECT_EQ(engine_.codecs()[0].id, config.decoders[0].payload_type);
2639 } 2639 }
2640 2640
2641 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsRejectUnsupportedCodec) { 2641 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsRejectUnsupportedCodec) {
2642 cricket::VideoRecvParameters parameters; 2642 cricket::VideoRecvParameters parameters;
2643 parameters.codecs.push_back(kVp8Codec); 2643 parameters.codecs.push_back(kVp8Codec);
2644 parameters.codecs.push_back(VideoCodec(101, "WTF3", 640, 400, 30)); 2644 parameters.codecs.push_back(VideoCodec(101, "WTF3", 640, 400, 30));
2645 EXPECT_FALSE(channel_->SetRecvParameters(parameters)); 2645 EXPECT_FALSE(channel_->SetRecvParameters(parameters));
2646 } 2646 }
(...skipping 17 matching lines...) Expand all
2664 } 2664 }
2665 2665
2666 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsWithoutFecDisablesFec) { 2666 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsWithoutFecDisablesFec) {
2667 cricket::VideoSendParameters send_parameters; 2667 cricket::VideoSendParameters send_parameters;
2668 send_parameters.codecs.push_back(kVp8Codec); 2668 send_parameters.codecs.push_back(kVp8Codec);
2669 send_parameters.codecs.push_back(kRedCodec); 2669 send_parameters.codecs.push_back(kRedCodec);
2670 send_parameters.codecs.push_back(kUlpfecCodec); 2670 send_parameters.codecs.push_back(kUlpfecCodec);
2671 ASSERT_TRUE(channel_->SetSendParameters(send_parameters)); 2671 ASSERT_TRUE(channel_->SetSendParameters(send_parameters));
2672 2672
2673 FakeVideoReceiveStream* stream = AddRecvStream(); 2673 FakeVideoReceiveStream* stream = AddRecvStream();
2674 webrtc::VideoReceiveStream::Config config = stream->GetConfig(); 2674 const webrtc::VideoReceiveStream::Config& config = stream->GetConfig();
2675 2675
2676 EXPECT_EQ(kUlpfecCodec.id, config.rtp.fec.ulpfec_payload_type); 2676 EXPECT_EQ(kUlpfecCodec.id, config.rtp.fec.ulpfec_payload_type);
pbos-webrtc 2016/06/06 16:15:34 Replace config.rtp.. with GetConfig().rtp in this
tommi 2016/06/08 09:49:39 Done.
2677 2677
2678 cricket::VideoRecvParameters recv_parameters; 2678 cricket::VideoRecvParameters recv_parameters;
2679 recv_parameters.codecs.push_back(kVp8Codec); 2679 recv_parameters.codecs.push_back(kVp8Codec);
2680 ASSERT_TRUE(channel_->SetRecvParameters(recv_parameters)); 2680 ASSERT_TRUE(channel_->SetRecvParameters(recv_parameters));
2681 stream = fake_call_->GetVideoReceiveStreams()[0]; 2681 stream = fake_call_->GetVideoReceiveStreams()[0];
2682 ASSERT_TRUE(stream != NULL); 2682 ASSERT_TRUE(stream != NULL);
2683 config = stream->GetConfig(); 2683 EXPECT_EQ(-1, stream->GetConfig().rtp.fec.ulpfec_payload_type)
2684 EXPECT_EQ(-1, config.rtp.fec.ulpfec_payload_type)
2685 << "SetSendCodec without FEC should disable current FEC."; 2684 << "SetSendCodec without FEC should disable current FEC.";
2686 } 2685 }
2687 2686
2688 TEST_F(WebRtcVideoChannel2Test, SetSendParamsWithoutFecDisablesReceivingFec) { 2687 TEST_F(WebRtcVideoChannel2Test, SetSendParamsWithoutFecDisablesReceivingFec) {
2689 FakeVideoReceiveStream* stream = AddRecvStream(); 2688 FakeVideoReceiveStream* stream = AddRecvStream();
2690 webrtc::VideoReceiveStream::Config config = stream->GetConfig(); 2689 EXPECT_EQ(kUlpfecCodec.id, stream->GetConfig().rtp.fec.ulpfec_payload_type);
2691
2692 EXPECT_EQ(kUlpfecCodec.id, config.rtp.fec.ulpfec_payload_type);
2693 2690
2694 cricket::VideoRecvParameters recv_parameters; 2691 cricket::VideoRecvParameters recv_parameters;
2695 recv_parameters.codecs.push_back(kVp8Codec); 2692 recv_parameters.codecs.push_back(kVp8Codec);
2696 recv_parameters.codecs.push_back(kRedCodec); 2693 recv_parameters.codecs.push_back(kRedCodec);
2697 recv_parameters.codecs.push_back(kUlpfecCodec); 2694 recv_parameters.codecs.push_back(kUlpfecCodec);
2698 ASSERT_TRUE(channel_->SetRecvParameters(recv_parameters)); 2695 ASSERT_TRUE(channel_->SetRecvParameters(recv_parameters));
2699 stream = fake_call_->GetVideoReceiveStreams()[0]; 2696 stream = fake_call_->GetVideoReceiveStreams()[0];
2700 ASSERT_TRUE(stream != NULL); 2697 ASSERT_TRUE(stream != NULL);
2701 config = stream->GetConfig(); 2698 EXPECT_EQ(kUlpfecCodec.id, stream->GetConfig().rtp.fec.ulpfec_payload_type)
2702 EXPECT_EQ(kUlpfecCodec.id, config.rtp.fec.ulpfec_payload_type)
2703 << "FEC should be enabled on the recieve stream."; 2699 << "FEC should be enabled on the recieve stream.";
2704 2700
2705 cricket::VideoSendParameters send_parameters; 2701 cricket::VideoSendParameters send_parameters;
2706 send_parameters.codecs.push_back(kVp8Codec); 2702 send_parameters.codecs.push_back(kVp8Codec);
2707 ASSERT_TRUE(channel_->SetSendParameters(send_parameters)); 2703 ASSERT_TRUE(channel_->SetSendParameters(send_parameters));
2708 stream = fake_call_->GetVideoReceiveStreams()[0]; 2704 stream = fake_call_->GetVideoReceiveStreams()[0];
2709 config = stream->GetConfig(); 2705 EXPECT_EQ(-1, stream->GetConfig().rtp.fec.ulpfec_payload_type)
2710 EXPECT_EQ(-1, config.rtp.fec.ulpfec_payload_type)
2711 << "FEC should have been disabled when we know the other side won't do " 2706 << "FEC should have been disabled when we know the other side won't do "
2712 "FEC."; 2707 "FEC.";
2713 2708
2714 send_parameters.codecs.push_back(kRedCodec); 2709 send_parameters.codecs.push_back(kRedCodec);
2715 send_parameters.codecs.push_back(kUlpfecCodec); 2710 send_parameters.codecs.push_back(kUlpfecCodec);
2716 ASSERT_TRUE(channel_->SetSendParameters(send_parameters)); 2711 ASSERT_TRUE(channel_->SetSendParameters(send_parameters));
2717 stream = fake_call_->GetVideoReceiveStreams()[0]; 2712 stream = fake_call_->GetVideoReceiveStreams()[0];
2718 config = stream->GetConfig(); 2713 EXPECT_EQ(kUlpfecCodec.id, stream->GetConfig().rtp.fec.ulpfec_payload_type)
2719 EXPECT_EQ(kUlpfecCodec.id, config.rtp.fec.ulpfec_payload_type)
2720 << "FEC should be enabled on the recieve stream."; 2714 << "FEC should be enabled on the recieve stream.";
2721 } 2715 }
2722 2716
2723 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectDuplicateFecPayloads) { 2717 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectDuplicateFecPayloads) {
2724 cricket::VideoRecvParameters parameters; 2718 cricket::VideoRecvParameters parameters;
2725 parameters.codecs.push_back(kVp8Codec); 2719 parameters.codecs.push_back(kVp8Codec);
2726 parameters.codecs.push_back(kRedCodec); 2720 parameters.codecs.push_back(kRedCodec);
2727 parameters.codecs[1].id = parameters.codecs[0].id; 2721 parameters.codecs[1].id = parameters.codecs[0].id;
2728 EXPECT_FALSE(channel_->SetRecvParameters(parameters)); 2722 EXPECT_FALSE(channel_->SetRecvParameters(parameters));
2729 } 2723 }
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
3767 } 3761 }
3768 3762
3769 // Test that we normalize send codec format size in simulcast. 3763 // Test that we normalize send codec format size in simulcast.
3770 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { 3764 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) {
3771 cricket::VideoCodec codec(kVp8Codec270p); 3765 cricket::VideoCodec codec(kVp8Codec270p);
3772 codec.width += 1; 3766 codec.width += 1;
3773 codec.height += 1; 3767 codec.height += 1;
3774 VerifySimulcastSettings(codec, 2, 2); 3768 VerifySimulcastSettings(codec, 2, 2);
3775 } 3769 }
3776 } // namespace cricket 3770 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698