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

Unified Diff: webrtc/pc/peerconnection_integrationtest.cc

Issue 2782273002: Fixing some case-sensitive codec name comparisons. (Closed)
Patch Set: Adding PeerConnection integration test for codec name casing. Created 3 years, 9 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 | « no previous file | webrtc/video/send_statistics_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « no previous file | webrtc/video/send_statistics_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698