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

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

Issue 2806173002: Fix RtpReceiver.GetParameters when SSRCs aren't signaled. (Closed)
Patch Set: Changing behavior slightly in response to comment on https://github.com/w3c/webrtc-pc/issues/1116 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
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.cc ('k') | webrtc/media/engine/webrtcvoiceengine.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 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 always return an empty "RtpEncodingParameters",
4141 // even after a packet is received and the unsignaled SSRC is known.
4142 TEST_F(WebRtcVideoChannel2Test, GetRtpReceiveParametersWithUnsignaledSsrc) {
4143 // Call necessary methods to configure receiving a default stream as
4144 // soon as it arrives.
4145 cricket::VideoRecvParameters parameters;
4146 parameters.codecs.push_back(GetEngineCodec("VP8"));
4147 parameters.codecs.push_back(GetEngineCodec("VP9"));
4148 EXPECT_TRUE(channel_->SetRecvParameters(parameters));
4149
4150 // Call GetRtpReceiveParameters before configured to receive an unsignaled
4151 // stream. Should return nothing.
4152 EXPECT_EQ(webrtc::RtpParameters(), channel_->GetRtpReceiveParameters(0));
4153
4154 // Set a sink for an unsignaled stream.
4155 cricket::FakeVideoRenderer renderer;
4156 // Value of "0" means "unsignaled stream".
4157 EXPECT_TRUE(channel_->SetSink(0, &renderer));
4158
4159 // Call GetRtpReceiveParameters before the SSRC is known. Value of "0"
4160 // in this method means "unsignaled stream".
4161 webrtc::RtpParameters rtp_parameters = channel_->GetRtpReceiveParameters(0);
4162 ASSERT_EQ(1u, rtp_parameters.encodings.size());
4163 EXPECT_FALSE(rtp_parameters.encodings[0].ssrc);
4164
4165 // Receive VP8 packet.
4166 uint8_t data[kMinRtpPacketLen];
4167 cricket::RtpHeader rtpHeader;
4168 rtpHeader.payload_type = GetEngineCodec("VP8").id;
4169 rtpHeader.seq_num = rtpHeader.timestamp = 0;
4170 rtpHeader.ssrc = kIncomingUnsignalledSsrc;
4171 cricket::SetRtpHeader(data, sizeof(data), rtpHeader);
4172 rtc::CopyOnWriteBuffer packet(data, sizeof(data));
4173 rtc::PacketTime packet_time;
4174 channel_->OnPacketReceived(&packet, packet_time);
4175
4176 // The |ssrc| member should still be unset.
4177 rtp_parameters = channel_->GetRtpReceiveParameters(0);
4178 ASSERT_EQ(1u, rtp_parameters.encodings.size());
4179 EXPECT_FALSE(rtp_parameters.encodings[0].ssrc);
4180 }
4181
4139 void WebRtcVideoChannel2Test::TestReceiverLocalSsrcConfiguration( 4182 void WebRtcVideoChannel2Test::TestReceiverLocalSsrcConfiguration(
4140 bool receiver_first) { 4183 bool receiver_first) {
4141 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 4184 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
4142 4185
4143 const uint32_t kSenderSsrc = 0xC0FFEE; 4186 const uint32_t kSenderSsrc = 0xC0FFEE;
4144 const uint32_t kSecondSenderSsrc = 0xBADCAFE; 4187 const uint32_t kSecondSenderSsrc = 0xBADCAFE;
4145 const uint32_t kReceiverSsrc = 0x4711; 4188 const uint32_t kReceiverSsrc = 0x4711;
4146 const uint32_t kExpectedDefaultReceiverSsrc = 1; 4189 const uint32_t kExpectedDefaultReceiverSsrc = 1;
4147 4190
4148 if (receiver_first) { 4191 if (receiver_first) {
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
4391 4434
4392 TEST_F(WebRtcVideoChannel2SimulcastTest, 4435 TEST_F(WebRtcVideoChannel2SimulcastTest,
4393 NoSimulcastScreenshareWithoutConference) { 4436 NoSimulcastScreenshareWithoutConference) {
4394 webrtc::test::ScopedFieldTrials override_field_trials_( 4437 webrtc::test::ScopedFieldTrials override_field_trials_(
4395 "WebRTC-SimulcastScreenshare/Enabled/"); 4438 "WebRTC-SimulcastScreenshare/Enabled/");
4396 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 1, true, 4439 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 1, true,
4397 false); 4440 false);
4398 } 4441 }
4399 4442
4400 } // namespace cricket 4443 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.cc ('k') | webrtc/media/engine/webrtcvoiceengine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698