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

Side by Side Diff: webrtc/media/engine/webrtcvoiceengine_unittest.cc

Issue 2685573003: Be less pessimistic about turning "default" receive streams into signaled streams. (Closed)
Patch Set: rebase Created 3 years, 10 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 | « webrtc/media/engine/webrtcvoiceengine.cc ('k') | no next file » | 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 (c) 2008 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2008 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 2796 matching lines...) Expand 10 before | Expand all | Expand 10 after
2807 2807
2808 DeliverPacket(packet, sizeof(packet)); 2808 DeliverPacket(packet, sizeof(packet));
2809 EXPECT_EQ(2, GetRecvStream(unsignaled_ssrc).received_packets()); 2809 EXPECT_EQ(2, GetRecvStream(unsignaled_ssrc).received_packets());
2810 2810
2811 rtc::SetBE32(&packet[8], signaled_ssrc); 2811 rtc::SetBE32(&packet[8], signaled_ssrc);
2812 DeliverPacket(packet, sizeof(packet)); 2812 DeliverPacket(packet, sizeof(packet));
2813 EXPECT_EQ(2, GetRecvStream(signaled_ssrc).received_packets()); 2813 EXPECT_EQ(2, GetRecvStream(signaled_ssrc).received_packets());
2814 EXPECT_EQ(2, call_.GetAudioReceiveStreams().size()); 2814 EXPECT_EQ(2, call_.GetAudioReceiveStreams().size());
2815 } 2815 }
2816 2816
2817 // Two tests to verify that adding a receive stream with the same SSRC as a
2818 // previously added unsignaled stream will only recreate underlying stream
2819 // objects if the stream parameters have changed.
2820 TEST_F(WebRtcVoiceEngineTestFake, AddRecvStreamAfterUnsignaled_NoRecreate) {
2821 EXPECT_TRUE(SetupChannel());
2822
2823 // Spawn unsignaled stream with SSRC=1.
2824 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame));
2825 EXPECT_EQ(1, call_.GetAudioReceiveStreams().size());
2826 EXPECT_TRUE(GetRecvStream(1).VerifyLastPacket(kPcmuFrame,
2827 sizeof(kPcmuFrame)));
2828
2829 // Verify that the underlying stream object in Call is not recreated when a
2830 // stream with SSRC=1 is added.
2831 const auto& streams = call_.GetAudioReceiveStreams();
2832 EXPECT_EQ(1, streams.size());
2833 int audio_receive_stream_id = streams.front()->id();
2834 EXPECT_TRUE(AddRecvStream(1));
2835 EXPECT_EQ(1, streams.size());
2836 EXPECT_EQ(audio_receive_stream_id, streams.front()->id());
2837 }
2838
2839 TEST_F(WebRtcVoiceEngineTestFake, AddRecvStreamAfterUnsignaled_Recreate) {
2840 EXPECT_TRUE(SetupChannel());
2841
2842 // Spawn unsignaled stream with SSRC=1.
2843 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame));
2844 EXPECT_EQ(1, call_.GetAudioReceiveStreams().size());
2845 EXPECT_TRUE(GetRecvStream(1).VerifyLastPacket(kPcmuFrame,
2846 sizeof(kPcmuFrame)));
2847
2848 // Verify that the underlying stream object in Call *is* recreated when a
2849 // stream with SSRC=1 is added, and which has changed stream parameters.
2850 const auto& streams = call_.GetAudioReceiveStreams();
2851 EXPECT_EQ(1, streams.size());
2852 int audio_receive_stream_id = streams.front()->id();
2853 cricket::StreamParams stream_params;
2854 stream_params.ssrcs.push_back(1);
2855 stream_params.sync_label = "sync_label";
2856 EXPECT_TRUE(channel_->AddRecvStream(stream_params));
2857 EXPECT_EQ(1, streams.size());
2858 EXPECT_NE(audio_receive_stream_id, streams.front()->id());
2859 }
2860
2817 // Test that we properly handle failures to add a receive stream. 2861 // Test that we properly handle failures to add a receive stream.
2818 TEST_F(WebRtcVoiceEngineTestFake, AddRecvStreamFail) { 2862 TEST_F(WebRtcVoiceEngineTestFake, AddRecvStreamFail) {
2819 EXPECT_TRUE(SetupChannel()); 2863 EXPECT_TRUE(SetupChannel());
2820 voe_.set_fail_create_channel(true); 2864 voe_.set_fail_create_channel(true);
2821 EXPECT_FALSE(AddRecvStream(2)); 2865 EXPECT_FALSE(AddRecvStream(2));
2822 } 2866 }
2823 2867
2824 // Test that we properly handle failures to add a send stream. 2868 // Test that we properly handle failures to add a send stream.
2825 TEST_F(WebRtcVoiceEngineTestFake, AddSendStreamFail) { 2869 TEST_F(WebRtcVoiceEngineTestFake, AddSendStreamFail) {
2826 EXPECT_TRUE(SetupChannel()); 2870 EXPECT_TRUE(SetupChannel());
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
3755 // Without this cast, the comparison turned unsigned and, thus, failed for -1. 3799 // Without this cast, the comparison turned unsigned and, thus, failed for -1.
3756 const int num_specs = static_cast<int>(specs.size()); 3800 const int num_specs = static_cast<int>(specs.size());
3757 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs); 3801 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs);
3758 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs); 3802 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs);
3759 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1); 3803 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1);
3760 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs); 3804 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs);
3761 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs); 3805 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs);
3762 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs); 3806 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs);
3763 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs); 3807 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs);
3764 } 3808 }
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698