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

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

Issue 2661453003: Simplify IsFmtpParam according to RFC 4855. (Closed)
Patch Set: Removed case-insensitive comparison. Added tests. Created 3 years, 10 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/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 3056 matching lines...) Expand 10 before | Expand all | Expand 10 after
3067 EXPECT_EQ(120, vp8.id); 3067 EXPECT_EQ(120, vp8.id);
3068 cricket::CodecParameterMap::iterator found = 3068 cricket::CodecParameterMap::iterator found =
3069 vp8.params.find("x-google-min-bitrate"); 3069 vp8.params.find("x-google-min-bitrate");
3070 ASSERT_TRUE(found != vp8.params.end()); 3070 ASSERT_TRUE(found != vp8.params.end());
3071 EXPECT_EQ(found->second, "10"); 3071 EXPECT_EQ(found->second, "10");
3072 found = vp8.params.find("x-google-max-quantization"); 3072 found = vp8.params.find("x-google-max-quantization");
3073 ASSERT_TRUE(found != vp8.params.end()); 3073 ASSERT_TRUE(found != vp8.params.end());
3074 EXPECT_EQ(found->second, "40"); 3074 EXPECT_EQ(found->second, "40");
3075 } 3075 }
3076 3076
3077 TEST_F(WebRtcSdpTest, SerializeAudioFmtpWithUnknownParameter) {
3078 AudioContentDescription* acd = static_cast<AudioContentDescription*>(
3079 GetFirstAudioContent(&desc_)->description);
3080
3081 cricket::AudioCodecs codecs = acd->codecs();
3082 codecs[0].params["unknown-future-parameter"] = "SomeFutureValue";
3083 acd->set_codecs(codecs);
3084
3085 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(),
3086 jdesc_.session_id(),
3087 jdesc_.session_version()));
3088 std::string message = webrtc::SdpSerialize(jdesc_, false);
3089 std::string sdp_with_fmtp = kSdpFullString;
3090 InjectAfter("a=rtpmap:111 opus/48000/2\r\n",
3091 "a=fmtp:111 unknown-future-parameter=SomeFutureValue\r\n",
3092 &sdp_with_fmtp);
3093 EXPECT_EQ(sdp_with_fmtp, message);
3094 }
3095
3096 TEST_F(WebRtcSdpTest, SerializeAudioFmtpWithKnownFmtpParameter) {
3097 AudioContentDescription* acd = static_cast<AudioContentDescription*>(
3098 GetFirstAudioContent(&desc_)->description);
3099
3100 cricket::AudioCodecs codecs = acd->codecs();
3101 codecs[0].params["stereo"] = "1";
3102 acd->set_codecs(codecs);
3103
3104 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(),
3105 jdesc_.session_id(),
3106 jdesc_.session_version()));
3107 std::string message = webrtc::SdpSerialize(jdesc_, false);
3108 std::string sdp_with_fmtp = kSdpFullString;
3109 InjectAfter("a=rtpmap:111 opus/48000/2\r\n",
3110 "a=fmtp:111 stereo=1\r\n",
3111 &sdp_with_fmtp);
3112 EXPECT_EQ(sdp_with_fmtp, message);
3113 }
3114
3115 TEST_F(WebRtcSdpTest, SerializeAudioFmtpWithPTimeAndMaxPTime) {
3116 AudioContentDescription* acd = static_cast<AudioContentDescription*>(
3117 GetFirstAudioContent(&desc_)->description);
3118
3119 cricket::AudioCodecs codecs = acd->codecs();
3120 codecs[0].params["ptime"] = "20";
3121 codecs[0].params["maxptime"] = "120";
3122 acd->set_codecs(codecs);
3123
3124 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(),
3125 jdesc_.session_id(),
3126 jdesc_.session_version()));
3127 std::string message = webrtc::SdpSerialize(jdesc_, false);
3128 std::string sdp_with_fmtp = kSdpFullString;
3129 InjectAfter("a=rtpmap:104 ISAC/32000\r\n",
3130 "a=maxptime:120\r\n" // No comma here. String merging!
3131 "a=ptime:20\r\n",
3132 &sdp_with_fmtp);
3133 EXPECT_EQ(sdp_with_fmtp, message);
3134 }
3135
3077 TEST_F(WebRtcSdpTest, SerializeVideoFmtp) { 3136 TEST_F(WebRtcSdpTest, SerializeVideoFmtp) {
3078 VideoContentDescription* vcd = static_cast<VideoContentDescription*>( 3137 VideoContentDescription* vcd = static_cast<VideoContentDescription*>(
3079 GetFirstVideoContent(&desc_)->description); 3138 GetFirstVideoContent(&desc_)->description);
3080 3139
3081 cricket::VideoCodecs codecs = vcd->codecs(); 3140 cricket::VideoCodecs codecs = vcd->codecs();
3082 codecs[0].params["x-google-min-bitrate"] = "10"; 3141 codecs[0].params["x-google-min-bitrate"] = "10";
3083 vcd->set_codecs(codecs); 3142 vcd->set_codecs(codecs);
3084 3143
3085 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(), 3144 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(),
3086 jdesc_.session_id(), 3145 jdesc_.session_id(),
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
3358 JsepSessionDescription jdesc_output(kDummyString); 3417 JsepSessionDescription jdesc_output(kDummyString);
3359 EXPECT_TRUE( 3418 EXPECT_TRUE(
3360 SdpDeserialize(kSdpWithIceCredentialsInCandidateString, &jdesc_output)); 3419 SdpDeserialize(kSdpWithIceCredentialsInCandidateString, &jdesc_output));
3361 const IceCandidateCollection* candidates = jdesc_output.candidates(0); 3420 const IceCandidateCollection* candidates = jdesc_output.candidates(0);
3362 ASSERT_NE(nullptr, candidates); 3421 ASSERT_NE(nullptr, candidates);
3363 ASSERT_EQ(1, candidates->count()); 3422 ASSERT_EQ(1, candidates->count());
3364 cricket::Candidate c = candidates->at(0)->candidate(); 3423 cricket::Candidate c = candidates->at(0)->candidate();
3365 EXPECT_EQ("ufrag_voice", c.username()); 3424 EXPECT_EQ("ufrag_voice", c.username());
3366 EXPECT_EQ("pwd_voice", c.password()); 3425 EXPECT_EQ("pwd_voice", c.password());
3367 } 3426 }
OLDNEW
« no previous file with comments | « webrtc/pc/webrtcsdp.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698