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

Side by Side 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, 8 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 | « no previous file | webrtc/video/send_statistics_proxy.cc » ('j') | 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 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 238
239 // Set a callback to be invoked when SDP is received via the fake signaling 239 // Set a callback to be invoked when SDP is received via the fake signaling
240 // channel, which provides an opportunity to munge (modify) the SDP. This is 240 // channel, which provides an opportunity to munge (modify) the SDP. This is
241 // used to test SDP being applied that a PeerConnection would normally not 241 // used to test SDP being applied that a PeerConnection would normally not
242 // generate, but a non-JSEP endpoint might. 242 // generate, but a non-JSEP endpoint might.
243 void SetReceivedSdpMunger( 243 void SetReceivedSdpMunger(
244 std::function<void(cricket::SessionDescription*)> munger) { 244 std::function<void(cricket::SessionDescription*)> munger) {
245 received_sdp_munger_ = munger; 245 received_sdp_munger_ = munger;
246 } 246 }
247 247
248 // Siimlar to the above, but this is run on SDP immediately after it's 248 // Similar to the above, but this is run on SDP immediately after it's
249 // generated. 249 // generated.
250 void SetGeneratedSdpMunger( 250 void SetGeneratedSdpMunger(
251 std::function<void(cricket::SessionDescription*)> munger) { 251 std::function<void(cricket::SessionDescription*)> munger) {
252 generated_sdp_munger_ = munger; 252 generated_sdp_munger_ = munger;
253 } 253 }
254 254
255 // Number of times the gathering state has transitioned to "gathering". 255 // Number of times the gathering state has transitioned to "gathering".
256 // Useful for telling if an ICE restart occurred as expected. 256 // Useful for telling if an ICE restart occurred as expected.
257 int transitions_to_gathering_state() const { 257 int transitions_to_gathering_state() const {
258 return transitions_to_gathering_state_; 258 return transitions_to_gathering_state_;
(...skipping 2435 matching lines...) Expand 10 before | Expand all | Expand 10 after
2694 webrtc::PeerConnectionInterface::kIceConnectionConnected || 2694 webrtc::PeerConnectionInterface::kIceConnectionConnected ||
2695 caller()->ice_connection_state() == 2695 caller()->ice_connection_state() ==
2696 webrtc::PeerConnectionInterface::kIceConnectionCompleted), 2696 webrtc::PeerConnectionInterface::kIceConnectionCompleted),
2697 total_connection_time_ms, fake_clock); 2697 total_connection_time_ms, fake_clock);
2698 // Need to free the clients here since they're using things we created on 2698 // Need to free the clients here since they're using things we created on
2699 // the stack. 2699 // the stack.
2700 delete SetCallerPcWrapperAndReturnCurrent(nullptr); 2700 delete SetCallerPcWrapperAndReturnCurrent(nullptr);
2701 delete SetCalleePcWrapperAndReturnCurrent(nullptr); 2701 delete SetCalleePcWrapperAndReturnCurrent(nullptr);
2702 } 2702 }
2703 2703
2704 // Test that audio and video flow end-to-end when codec names don't use the
2705 // expected casing, given that they're supposed to be case insensitive. To test
2706 // this, all but one codec is removed from each media description, and its
2707 // casing is changed.
2708 //
2709 // In the past, this has regressed and caused crashes/black video, due to the
2710 // fact that code at some layers was doing case-insensitive comparisons and
2711 // code at other layers was not.
2712 TEST_F(PeerConnectionIntegrationTest, CodecNamesAreCaseInsensitive) {
2713 ASSERT_TRUE(CreatePeerConnectionWrappers());
2714 ConnectFakeSignaling();
2715 caller()->AddAudioVideoMediaStream();
2716 callee()->AddAudioVideoMediaStream();
2717
2718 // Remove all but one audio/video codec (opus and VP8), and change the
2719 // casing of the caller's generated offer.
2720 caller()->SetGeneratedSdpMunger([](cricket::SessionDescription* description) {
2721 cricket::AudioContentDescription* audio =
2722 GetFirstAudioContentDescription(description);
2723 ASSERT_NE(nullptr, audio);
2724 auto audio_codecs = audio->codecs();
2725 audio_codecs.erase(std::remove_if(audio_codecs.begin(), audio_codecs.end(),
2726 [](const cricket::AudioCodec& codec) {
2727 return codec.name != "opus";
2728 }),
2729 audio_codecs.end());
2730 ASSERT_EQ(1u, audio_codecs.size());
2731 audio_codecs[0].name = "OpUs";
2732 audio->set_codecs(audio_codecs);
2733
2734 cricket::VideoContentDescription* video =
2735 GetFirstVideoContentDescription(description);
2736 ASSERT_NE(nullptr, video);
2737 auto video_codecs = video->codecs();
2738 video_codecs.erase(std::remove_if(video_codecs.begin(), video_codecs.end(),
2739 [](const cricket::VideoCodec& codec) {
2740 return codec.name != "VP8";
2741 }),
2742 video_codecs.end());
2743 ASSERT_EQ(1u, video_codecs.size());
2744 video_codecs[0].name = "vP8";
2745 video->set_codecs(video_codecs);
2746 });
2747
2748 caller()->CreateAndSetAndSignalOffer();
2749 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
2750
2751 // Verify frames are still received end-to-end.
2752 ExpectNewFramesReceivedWithWait(
2753 kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount,
2754 kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount,
2755 kMaxWaitForFramesMs);
2756 }
2757
2704 } // namespace 2758 } // namespace
2705 2759
2706 #endif // if !defined(THREAD_SANITIZER) 2760 #endif // if !defined(THREAD_SANITIZER)
OLDNEW
« 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