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

Side by Side Diff: webrtc/pc/webrtcsdp_unittest.cc

Issue 2995463002: Ignore "b=AS:-1" instead of treating as a hard error. (Closed)
Patch Set: Add back error for bandwidth lower than -1. Created 3 years, 4 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
« webrtc/pc/webrtcsdp.cc ('K') | « webrtc/pc/webrtcsdp.cc ('k') | 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 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2011 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 3340 matching lines...) Expand 10 before | Expand all | Expand 10 after
3351 "v=0\r\n" 3351 "v=0\r\n"
3352 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n" 3352 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n"
3353 "s=-\r\n" 3353 "s=-\r\n"
3354 "t=0 0\r\n" 3354 "t=0 0\r\n"
3355 "m=video 3457 RTP/SAVPF 120\r\n" 3355 "m=video 3457 RTP/SAVPF 120\r\n"
3356 "b=AS:-1000\r\n"; 3356 "b=AS:-1000\r\n";
3357 3357
3358 ExpectParseFailure(std::string(kSdpWithNegativeBandwidth), "b=AS:-1000"); 3358 ExpectParseFailure(std::string(kSdpWithNegativeBandwidth), "b=AS:-1000");
3359 } 3359 }
3360 3360
3361 // An exception to the above rule: a value of -1 for b=AS should just be
3362 // ignored, resulting in "kAutoBandwidth" in the deserialized object.
3363 // Applications historically may be using "b=AS:-1" to mean "no bandwidth
3364 // limit", but this is now what ommitting the attribute entirely will do, so
3365 // ignoring it will have the intended effect.
3366 TEST_F(WebRtcSdpTest, BandwidthLimitOfNegativeOneIgnored) {
3367 static const char kSdpWithBandwidthOfNegativeOne[] =
3368 "v=0\r\n"
3369 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n"
3370 "s=-\r\n"
3371 "t=0 0\r\n"
3372 "m=video 3457 RTP/SAVPF 120\r\n"
3373 "b=AS:-1\r\n";
3374
3375 JsepSessionDescription jdesc_output(kDummyString);
3376 EXPECT_TRUE(SdpDeserialize(kSdpWithBandwidthOfNegativeOne, &jdesc_output));
3377 const ContentInfo* vc = GetFirstVideoContent(jdesc_output.description());
3378 ASSERT_NE(nullptr, vc);
3379 const VideoContentDescription* vcd =
3380 static_cast<const VideoContentDescription*>(vc->description);
3381 EXPECT_EQ(cricket::kAutoBandwidth, vcd->bandwidth());
3382 }
3383
3361 // Test that "ufrag"/"pwd" in the candidate line itself are ignored, and only 3384 // Test that "ufrag"/"pwd" in the candidate line itself are ignored, and only
3362 // the "a=ice-ufrag"/"a=ice-pwd" attributes are used. 3385 // the "a=ice-ufrag"/"a=ice-pwd" attributes are used.
3363 // Regression test for: 3386 // Regression test for:
3364 // https://bugs.chromium.org/p/chromium/issues/detail?id=681286 3387 // https://bugs.chromium.org/p/chromium/issues/detail?id=681286
3365 TEST_F(WebRtcSdpTest, IceCredentialsInCandidateStringIgnored) { 3388 TEST_F(WebRtcSdpTest, IceCredentialsInCandidateStringIgnored) {
3366 // Important piece is "ufrag foo pwd bar". 3389 // Important piece is "ufrag foo pwd bar".
3367 static const char kSdpWithIceCredentialsInCandidateString[] = 3390 static const char kSdpWithIceCredentialsInCandidateString[] =
3368 "v=0\r\n" 3391 "v=0\r\n"
3369 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n" 3392 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n"
3370 "s=-\r\n" 3393 "s=-\r\n"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
3553 EXPECT_TRUE(SdpDeserialize(message, &jdesc)); 3576 EXPECT_TRUE(SdpDeserialize(message, &jdesc));
3554 auto audio_desc = static_cast<cricket::MediaContentDescription*>( 3577 auto audio_desc = static_cast<cricket::MediaContentDescription*>(
3555 jdesc.description()->GetContentByName(kAudioContentName)->description); 3578 jdesc.description()->GetContentByName(kAudioContentName)->description);
3556 auto video_desc = static_cast<cricket::MediaContentDescription*>( 3579 auto video_desc = static_cast<cricket::MediaContentDescription*>(
3557 jdesc.description()->GetContentByName(kVideoContentName)->description); 3580 jdesc.description()->GetContentByName(kVideoContentName)->description);
3558 EXPECT_EQ(audio_desc_->connection_address().ToString(), 3581 EXPECT_EQ(audio_desc_->connection_address().ToString(),
3559 audio_desc->connection_address().ToString()); 3582 audio_desc->connection_address().ToString());
3560 EXPECT_EQ(video_desc_->connection_address().ToString(), 3583 EXPECT_EQ(video_desc_->connection_address().ToString(),
3561 video_desc->connection_address().ToString()); 3584 video_desc->connection_address().ToString());
3562 } 3585 }
OLDNEW
« webrtc/pc/webrtcsdp.cc ('K') | « webrtc/pc/webrtcsdp.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698