Index: webrtc/pc/peerconnection_integrationtest.cc |
diff --git a/webrtc/pc/peerconnection_integrationtest.cc b/webrtc/pc/peerconnection_integrationtest.cc |
index 8a4df9b1893a40350d266f6bebe93bcfdea78ddb..b4acdaa423f7851b08ee4b2d6e7ec2288e7ef29f 100644 |
--- a/webrtc/pc/peerconnection_integrationtest.cc |
+++ b/webrtc/pc/peerconnection_integrationtest.cc |
@@ -245,7 +245,7 @@ class PeerConnectionWrapper : public webrtc::PeerConnectionObserver, |
received_sdp_munger_ = munger; |
} |
- // Siimlar to the above, but this is run on SDP immediately after it's |
+ // Similar to the above, but this is run on SDP immediately after it's |
// generated. |
void SetGeneratedSdpMunger( |
std::function<void(cricket::SessionDescription*)> munger) { |
@@ -2701,6 +2701,60 @@ TEST_F(PeerConnectionIntegrationTest, EndToEndConnectionTimeWithTurnTurnPair) { |
delete SetCalleePcWrapperAndReturnCurrent(nullptr); |
} |
+// Test that audio and video flow end-to-end when codec names don't use the |
+// expected casing, given that they're supposed to be case insensitive. To test |
+// this, all but one codec is removed from each media description, and its |
+// casing is changed. |
+// |
+// In the past, this has regressed and caused crashes/black video, due to the |
+// fact that code at some layers was doing case-insensitive comparisons and |
+// code at other layers was not. |
+TEST_F(PeerConnectionIntegrationTest, CodecNamesAreCaseInsensitive) { |
+ ASSERT_TRUE(CreatePeerConnectionWrappers()); |
+ ConnectFakeSignaling(); |
+ caller()->AddAudioVideoMediaStream(); |
+ callee()->AddAudioVideoMediaStream(); |
+ |
+ // Remove all but one audio/video codec (opus and VP8), and change the |
+ // casing of the caller's generated offer. |
+ caller()->SetGeneratedSdpMunger([](cricket::SessionDescription* description) { |
+ cricket::AudioContentDescription* audio = |
+ GetFirstAudioContentDescription(description); |
+ ASSERT_NE(nullptr, audio); |
+ auto audio_codecs = audio->codecs(); |
+ audio_codecs.erase(std::remove_if(audio_codecs.begin(), audio_codecs.end(), |
+ [](const cricket::AudioCodec& codec) { |
+ return codec.name != "opus"; |
+ }), |
+ audio_codecs.end()); |
+ ASSERT_EQ(1u, audio_codecs.size()); |
+ audio_codecs[0].name = "OpUs"; |
+ audio->set_codecs(audio_codecs); |
+ |
+ cricket::VideoContentDescription* video = |
+ GetFirstVideoContentDescription(description); |
+ ASSERT_NE(nullptr, video); |
+ auto video_codecs = video->codecs(); |
+ video_codecs.erase(std::remove_if(video_codecs.begin(), video_codecs.end(), |
+ [](const cricket::VideoCodec& codec) { |
+ return codec.name != "VP8"; |
+ }), |
+ video_codecs.end()); |
+ ASSERT_EQ(1u, video_codecs.size()); |
+ video_codecs[0].name = "vP8"; |
+ video->set_codecs(video_codecs); |
+ }); |
+ |
+ caller()->CreateAndSetAndSignalOffer(); |
+ ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); |
+ |
+ // Verify frames are still received end-to-end. |
+ ExpectNewFramesReceivedWithWait( |
+ kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount, |
+ kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount, |
+ kMaxWaitForFramesMs); |
+} |
+ |
} // namespace |
#endif // if !defined(THREAD_SANITIZER) |