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

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

Issue 2806173002: Fix RtpReceiver.GetParameters when SSRCs aren't signaled. (Closed)
Patch Set: Created 3 years, 8 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 4118 matching lines...) Expand 10 before | Expand all | Expand 10 after
4129 channel_->GetRtpReceiveParameters(last_ssrc_); 4129 channel_->GetRtpReceiveParameters(last_ssrc_);
4130 4130
4131 // We should be able to set the params we just got. 4131 // We should be able to set the params we just got.
4132 EXPECT_TRUE(channel_->SetRtpReceiveParameters(last_ssrc_, initial_params)); 4132 EXPECT_TRUE(channel_->SetRtpReceiveParameters(last_ssrc_, initial_params));
4133 4133
4134 // ... And this shouldn't change the params returned by 4134 // ... And this shouldn't change the params returned by
4135 // GetRtpReceiveParameters. 4135 // GetRtpReceiveParameters.
4136 EXPECT_EQ(initial_params, channel_->GetRtpReceiveParameters(last_ssrc_)); 4136 EXPECT_EQ(initial_params, channel_->GetRtpReceiveParameters(last_ssrc_));
4137 } 4137 }
4138 4138
4139 // Test that GetRtpReceiveParameters returns parameters correctly when SSRCs
4140 // aren't signaled. It should return an empty "RtpEncodingParameters" when
4141 // configured to receive an unsignaled stream and no packets have been received
4142 // yet, and start returning the SSRC once a packet has been received.
4143 TEST_F(WebRtcVideoChannel2Test, GetRtpReceiveParametersWithUnsignaledSsrc) {
4144 // Call necessary methods to configure receiving a default stream as
4145 // soon as it arrives.
4146 cricket::VideoRecvParameters parameters;
4147 parameters.codecs.push_back(GetEngineCodec("VP8"));
4148 parameters.codecs.push_back(GetEngineCodec("VP9"));
4149 EXPECT_TRUE(channel_->SetRecvParameters(parameters));
4150
4151 // Call GetRtpReceiveParameters before configured to receive an unsignaled
4152 // stream. Should return nothing.
4153 EXPECT_EQ(webrtc::RtpParameters(), channel_->GetRtpReceiveParameters(0));
4154
4155 // Set a sink for an unsignaled stream.
4156 cricket::FakeVideoRenderer renderer;
4157 // Value of "0" means "unsignaled stream".
4158 EXPECT_TRUE(channel_->SetSink(0, &renderer));
4159
4160 // Call GetRtpReceiveParameters before the SSRC is known. Value of "0"
4161 // in this method means "unsignaled stream".
4162 webrtc::RtpParameters rtp_parameters = channel_->GetRtpReceiveParameters(0);
4163 ASSERT_EQ(1u, rtp_parameters.encodings.size());
4164 EXPECT_FALSE(rtp_parameters.encodings[0].ssrc);
4165
4166 // Receive VP8 packet.
4167 uint8_t data[kMinRtpPacketLen];
4168 cricket::RtpHeader rtpHeader;
4169 rtpHeader.payload_type = GetEngineCodec("VP8").id;
4170 rtpHeader.seq_num = rtpHeader.timestamp = 0;
4171 rtpHeader.ssrc = kIncomingUnsignalledSsrc;
4172 cricket::SetRtpHeader(data, sizeof(data), rtpHeader);
4173 rtc::CopyOnWriteBuffer packet(data, sizeof(data));
4174 rtc::PacketTime packet_time;
4175 channel_->OnPacketReceived(&packet, packet_time);
4176
4177 // Now when we call GetRtpReceiveParameters, we should get an SSRC.
4178 rtp_parameters = channel_->GetRtpReceiveParameters(0);
4179 ASSERT_EQ(1u, rtp_parameters.encodings.size());
4180 ASSERT_TRUE(rtp_parameters.encodings[0].ssrc);
4181 EXPECT_EQ(kIncomingUnsignalledSsrc, *rtp_parameters.encodings[0].ssrc);
4182 }
4183
4139 void WebRtcVideoChannel2Test::TestReceiverLocalSsrcConfiguration( 4184 void WebRtcVideoChannel2Test::TestReceiverLocalSsrcConfiguration(
4140 bool receiver_first) { 4185 bool receiver_first) {
4141 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 4186 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
4142 4187
4143 const uint32_t kSenderSsrc = 0xC0FFEE; 4188 const uint32_t kSenderSsrc = 0xC0FFEE;
4144 const uint32_t kSecondSenderSsrc = 0xBADCAFE; 4189 const uint32_t kSecondSenderSsrc = 0xBADCAFE;
4145 const uint32_t kReceiverSsrc = 0x4711; 4190 const uint32_t kReceiverSsrc = 0x4711;
4146 const uint32_t kExpectedDefaultReceiverSsrc = 1; 4191 const uint32_t kExpectedDefaultReceiverSsrc = 1;
4147 4192
4148 if (receiver_first) { 4193 if (receiver_first) {
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
4391 4436
4392 TEST_F(WebRtcVideoChannel2SimulcastTest, 4437 TEST_F(WebRtcVideoChannel2SimulcastTest,
4393 NoSimulcastScreenshareWithoutConference) { 4438 NoSimulcastScreenshareWithoutConference) {
4394 webrtc::test::ScopedFieldTrials override_field_trials_( 4439 webrtc::test::ScopedFieldTrials override_field_trials_(
4395 "WebRTC-SimulcastScreenshare/Enabled/"); 4440 "WebRTC-SimulcastScreenshare/Enabled/");
4396 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 1, true, 4441 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 1, true,
4397 false); 4442 false);
4398 } 4443 }
4399 4444
4400 } // namespace cricket 4445 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698