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

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

Issue 1938503002: Fix RTX-configuration test with >2 codecs built. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: feedback Created 4 years, 7 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 | « no previous file | no next file » | 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 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 FakeVideoSendStream* send_stream = AddSendStream( 1156 FakeVideoSendStream* send_stream = AddSendStream(
1157 cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs)); 1157 cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs));
1158 1158
1159 ASSERT_EQ(rtx_ssrcs.size(), send_stream->GetConfig().rtp.rtx.ssrcs.size()); 1159 ASSERT_EQ(rtx_ssrcs.size(), send_stream->GetConfig().rtp.rtx.ssrcs.size());
1160 for (size_t i = 0; i < rtx_ssrcs.size(); ++i) 1160 for (size_t i = 0; i < rtx_ssrcs.size(); ++i)
1161 EXPECT_EQ(rtx_ssrcs[i], send_stream->GetConfig().rtp.rtx.ssrcs[i]); 1161 EXPECT_EQ(rtx_ssrcs[i], send_stream->GetConfig().rtp.rtx.ssrcs[i]);
1162 1162
1163 // Receiver side. 1163 // Receiver side.
1164 FakeVideoReceiveStream* recv_stream = AddRecvStream( 1164 FakeVideoReceiveStream* recv_stream = AddRecvStream(
1165 cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs)); 1165 cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs));
1166 ASSERT_GT(recv_stream->GetConfig().rtp.rtx.size(), 0u) 1166 EXPECT_FALSE(recv_stream->GetConfig().rtp.rtx.empty());
1167 << "No SSRCs for RTX configured by AddRecvStream."; 1167 EXPECT_EQ(recv_stream->GetConfig().decoders.size(),
1168 EXPECT_EQ(rtx_ssrcs[0], 1168 recv_stream->GetConfig().rtp.rtx.size())
1169 recv_stream->GetConfig().rtp.rtx.begin()->second.ssrc); 1169 << "RTX should be mapped for all decoders/payload types.";
1170 // TODO(pbos): Make sure we set the RTX for correct payloads etc. 1170 for (const auto& kv : recv_stream->GetConfig().rtp.rtx) {
1171 EXPECT_EQ(rtx_ssrcs[0], kv.second.ssrc);
1172 }
1171 } 1173 }
1172 1174
1173 TEST_F(WebRtcVideoChannel2Test, RecvStreamWithRtx) { 1175 TEST_F(WebRtcVideoChannel2Test, RecvStreamWithRtx) {
1174 // Setup one channel with an associated RTX stream. 1176 // Setup one channel with an associated RTX stream.
1175 cricket::StreamParams params = 1177 cricket::StreamParams params =
1176 cricket::StreamParams::CreateLegacy(kSsrcs1[0]); 1178 cricket::StreamParams::CreateLegacy(kSsrcs1[0]);
1177 params.AddFidSsrc(kSsrcs1[0], kRtxSsrcs1[0]); 1179 params.AddFidSsrc(kSsrcs1[0], kRtxSsrcs1[0]);
1178 FakeVideoReceiveStream* recv_stream = AddRecvStream(params); 1180 FakeVideoReceiveStream* recv_stream = AddRecvStream(params);
1179 EXPECT_EQ(kRtxSsrcs1[0], 1181 EXPECT_EQ(kRtxSsrcs1[0],
1180 recv_stream->GetConfig().rtp.rtx.begin()->second.ssrc); 1182 recv_stream->GetConfig().rtp.rtx.begin()->second.ssrc);
(...skipping 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after
3192 uint8_t data[kDataLength]; 3194 uint8_t data[kDataLength];
3193 memset(data, 0, sizeof(data)); 3195 memset(data, 0, sizeof(data));
3194 rtc::SetBE32(&data[8], ssrcs[0]); 3196 rtc::SetBE32(&data[8], ssrcs[0]);
3195 rtc::CopyOnWriteBuffer packet(data, kDataLength); 3197 rtc::CopyOnWriteBuffer packet(data, kDataLength);
3196 rtc::PacketTime packet_time; 3198 rtc::PacketTime packet_time;
3197 channel_->OnPacketReceived(&packet, packet_time); 3199 channel_->OnPacketReceived(&packet, packet_time);
3198 3200
3199 ASSERT_EQ(1u, fake_call_->GetVideoReceiveStreams().size()) 3201 ASSERT_EQ(1u, fake_call_->GetVideoReceiveStreams().size())
3200 << "No default receive stream created."; 3202 << "No default receive stream created.";
3201 FakeVideoReceiveStream* recv_stream = fake_call_->GetVideoReceiveStreams()[0]; 3203 FakeVideoReceiveStream* recv_stream = fake_call_->GetVideoReceiveStreams()[0];
3202 EXPECT_EQ(0u, recv_stream->GetConfig().rtp.rtx.size()) 3204 EXPECT_TRUE(recv_stream->GetConfig().rtp.rtx.empty())
3203 << "Default receive stream should not have configured RTX"; 3205 << "Default receive stream should not have configured RTX";
3204 3206
3205 EXPECT_TRUE(channel_->AddRecvStream( 3207 EXPECT_TRUE(channel_->AddRecvStream(
3206 cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs))); 3208 cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs)));
3207 ASSERT_EQ(1u, fake_call_->GetVideoReceiveStreams().size()) 3209 ASSERT_EQ(1u, fake_call_->GetVideoReceiveStreams().size())
3208 << "AddRecvStream should've reconfigured, not added a new receiver."; 3210 << "AddRecvStream should've reconfigured, not added a new receiver.";
3209 recv_stream = fake_call_->GetVideoReceiveStreams()[0]; 3211 recv_stream = fake_call_->GetVideoReceiveStreams()[0];
3210 ASSERT_GE(2u, recv_stream->GetConfig().rtp.rtx.size()); 3212 EXPECT_FALSE(recv_stream->GetConfig().rtp.rtx.empty());
3211 EXPECT_EQ(rtx_ssrcs[0], 3213 EXPECT_EQ(recv_stream->GetConfig().decoders.size(),
3212 recv_stream->GetConfig().rtp.rtx.begin()->second.ssrc); 3214 recv_stream->GetConfig().rtp.rtx.size())
3215 << "RTX should be mapped for all decoders/payload types.";
3216 for (const auto& kv : recv_stream->GetConfig().rtp.rtx) {
3217 EXPECT_EQ(rtx_ssrcs[0], kv.second.ssrc);
3218 }
3213 } 3219 }
3214 3220
3215 TEST_F(WebRtcVideoChannel2Test, RejectsAddingStreamsWithMissingSsrcsForRtx) { 3221 TEST_F(WebRtcVideoChannel2Test, RejectsAddingStreamsWithMissingSsrcsForRtx) {
3216 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 3222 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
3217 3223
3218 const std::vector<uint32_t> ssrcs = MAKE_VECTOR(kSsrcs1); 3224 const std::vector<uint32_t> ssrcs = MAKE_VECTOR(kSsrcs1);
3219 const std::vector<uint32_t> rtx_ssrcs = MAKE_VECTOR(kRtxSsrcs1); 3225 const std::vector<uint32_t> rtx_ssrcs = MAKE_VECTOR(kRtxSsrcs1);
3220 3226
3221 StreamParams sp = 3227 StreamParams sp =
3222 cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs); 3228 cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs);
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
3687 } 3693 }
3688 3694
3689 // Test that we normalize send codec format size in simulcast. 3695 // Test that we normalize send codec format size in simulcast.
3690 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { 3696 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) {
3691 cricket::VideoCodec codec(kVp8Codec270p); 3697 cricket::VideoCodec codec(kVp8Codec270p);
3692 codec.width += 1; 3698 codec.width += 1;
3693 codec.height += 1; 3699 codec.height += 1;
3694 VerifySimulcastSettings(codec, 2, 2); 3700 VerifySimulcastSettings(codec, 2, 2);
3695 } 3701 }
3696 } // namespace cricket 3702 } // namespace cricket
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698