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

Unified 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, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/pc/webrtcsdp.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/webrtcsdp_unittest.cc
diff --git a/webrtc/pc/webrtcsdp_unittest.cc b/webrtc/pc/webrtcsdp_unittest.cc
index 43774abf7d72564c2940383fa06672942115b3ae..81a5aaf4fe65634bb5bf78b66d08fe46425aeeee 100644
--- a/webrtc/pc/webrtcsdp_unittest.cc
+++ b/webrtc/pc/webrtcsdp_unittest.cc
@@ -3074,6 +3074,65 @@ TEST_F(WebRtcSdpTest, DeserializeVideoFmtpWithSpace) {
EXPECT_EQ(found->second, "40");
}
+TEST_F(WebRtcSdpTest, SerializeAudioFmtpWithUnknownParameter) {
+ AudioContentDescription* acd = static_cast<AudioContentDescription*>(
+ GetFirstAudioContent(&desc_)->description);
+
+ cricket::AudioCodecs codecs = acd->codecs();
+ codecs[0].params["unknown-future-parameter"] = "SomeFutureValue";
+ acd->set_codecs(codecs);
+
+ ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(),
+ jdesc_.session_id(),
+ jdesc_.session_version()));
+ std::string message = webrtc::SdpSerialize(jdesc_, false);
+ std::string sdp_with_fmtp = kSdpFullString;
+ InjectAfter("a=rtpmap:111 opus/48000/2\r\n",
+ "a=fmtp:111 unknown-future-parameter=SomeFutureValue\r\n",
+ &sdp_with_fmtp);
+ EXPECT_EQ(sdp_with_fmtp, message);
+}
+
+TEST_F(WebRtcSdpTest, SerializeAudioFmtpWithKnownFmtpParameter) {
+ AudioContentDescription* acd = static_cast<AudioContentDescription*>(
+ GetFirstAudioContent(&desc_)->description);
+
+ cricket::AudioCodecs codecs = acd->codecs();
+ codecs[0].params["stereo"] = "1";
+ acd->set_codecs(codecs);
+
+ ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(),
+ jdesc_.session_id(),
+ jdesc_.session_version()));
+ std::string message = webrtc::SdpSerialize(jdesc_, false);
+ std::string sdp_with_fmtp = kSdpFullString;
+ InjectAfter("a=rtpmap:111 opus/48000/2\r\n",
+ "a=fmtp:111 stereo=1\r\n",
+ &sdp_with_fmtp);
+ EXPECT_EQ(sdp_with_fmtp, message);
+}
+
+TEST_F(WebRtcSdpTest, SerializeAudioFmtpWithPTimeAndMaxPTime) {
+ AudioContentDescription* acd = static_cast<AudioContentDescription*>(
+ GetFirstAudioContent(&desc_)->description);
+
+ cricket::AudioCodecs codecs = acd->codecs();
+ codecs[0].params["ptime"] = "20";
+ codecs[0].params["maxptime"] = "120";
+ acd->set_codecs(codecs);
+
+ ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(),
+ jdesc_.session_id(),
+ jdesc_.session_version()));
+ std::string message = webrtc::SdpSerialize(jdesc_, false);
+ std::string sdp_with_fmtp = kSdpFullString;
+ InjectAfter("a=rtpmap:104 ISAC/32000\r\n",
+ "a=maxptime:120\r\n" // No comma here. String merging!
+ "a=ptime:20\r\n",
+ &sdp_with_fmtp);
+ EXPECT_EQ(sdp_with_fmtp, message);
+}
+
TEST_F(WebRtcSdpTest, SerializeVideoFmtp) {
VideoContentDescription* vcd = static_cast<VideoContentDescription*>(
GetFirstVideoContent(&desc_)->description);
« 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