Index: webrtc/api/webrtcsdp_unittest.cc |
diff --git a/webrtc/api/webrtcsdp_unittest.cc b/webrtc/api/webrtcsdp_unittest.cc |
index c52720453b7021042760dabc688efd5768dc94fd..aaa35af8d49924a004eca3fa8cc8b91f986df0ef 100644 |
--- a/webrtc/api/webrtcsdp_unittest.cc |
+++ b/webrtc/api/webrtcsdp_unittest.cc |
@@ -25,6 +25,8 @@ |
#include "webrtc/base/stringencode.h" |
#include "webrtc/base/stringutils.h" |
#include "webrtc/media/base/mediaconstants.h" |
+#include "webrtc/media/engine/webrtcvideoengine2.h" |
+#include "webrtc/modules/video_coding/codecs/h264/include/h264.h" |
#include "webrtc/p2p/base/p2pconstants.h" |
#include "webrtc/pc/mediasession.h" |
@@ -2088,6 +2090,33 @@ TEST_F(WebRtcSdpTest, SerializeTcpCandidates) { |
EXPECT_EQ(std::string(kSdpTcpActiveCandidate), message); |
} |
+TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithH264) { |
+ if (webrtc::H264Encoder::IsSupported()) { |
tommi
2016/04/12 10:10:26
nit: change to
if (!webrtc::H264Encoder::IsSuppor
|
+ for (const auto& codec : cricket::DefaultVideoCodecList()) { |
+ video_desc_->AddCodec(codec); |
+ } |
+ jdesc_.Initialize(desc_.Copy(), kSessionId, kSessionVersion); |
+ |
+ std::string message = webrtc::SdpSerialize(jdesc_, false); |
+ size_t after_pt = message.find(" H264/90000"); |
hbos
2016/04/12 10:14:23
Can we also make sure that the m=video line contai
hta-webrtc
2016/04/12 11:21:37
Argh. Can do this, but now we're passing the level
hbos
2016/04/12 11:41:14
Acknowledged.
|
+ ASSERT_NE(after_pt, std::string::npos); |
+ size_t before_pt = message.rfind("a=rtpmap:", after_pt); |
+ ASSERT_NE(before_pt, std::string::npos); |
+ before_pt += strlen("a=rtpmap:"); |
+ std::string pt = message.substr(before_pt, after_pt - before_pt); |
+ std::string to_find = "a=fmtp:" + pt + " "; |
+ size_t fmtp_pos = message.find(to_find); |
+ ASSERT_NE(std::string::npos, fmtp_pos) << "Failed to find " << to_find; |
+ size_t fmtp_endpos = message.find("\n", fmtp_pos); |
+ ASSERT_NE(std::string::npos, fmtp_endpos); |
+ std::string fmtp_value = message.substr(fmtp_pos, fmtp_endpos); |
+ EXPECT_NE(std::string::npos, fmtp_value.find("level-asymmetry-allowed=1")); |
+ EXPECT_NE(std::string::npos, fmtp_value.find("packetization-mode=1")); |
+ EXPECT_NE(std::string::npos, fmtp_value.find("profile-level-id=42e01f")); |
+ // Provoke an error to verify that test is run. |
tommi
2016/04/12 10:10:26
I'm not groking this comment... is it a todo?
hbos
2016/04/12 10:14:23
Old comment that should be removed?
hta-webrtc
2016/04/12 11:21:37
Yep. Done.
|
+ } |
hbos
2016/04/12 10:14:23
Optional: How about logging if the test was skippe
hta-webrtc
2016/04/12 11:21:38
Will only have any effect if people actually look
|
+} |
+ |
TEST_F(WebRtcSdpTest, DeserializeSessionDescription) { |
JsepSessionDescription jdesc(kDummyString); |
// Deserialize |