Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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) { | |
|
Taylor Brandstetter
2017/02/17 16:24:51
nit: I'd call this
AddRecvStreamAfterUnsignaledN
ossu
2017/02/17 17:05:10
Not sure if we do this in other places, but I'd fi
the sun
2017/02/17 17:19:09
Uhm. I think super long names are not very readabl
Taylor Brandstetter
2017/02/17 17:53:44
Yeah, that's fine.
| |
| 2821 EXPECT_TRUE(SetupChannel()); | |
| 2822 | |
| 2823 // Spawn unsignaled stream with SSRC=1. | |
| 2824 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame)); | |
|
Taylor Brandstetter
2017/02/17 16:24:51
This test relies on the fact that kPcmuFrame uses
the sun
2017/02/17 17:19:09
I think I'll instead make a helper:
void DeliverP
Taylor Brandstetter
2017/02/17 17:53:44
Sounds good.
| |
| 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 Loading... | |
| 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 } |
| OLD | NEW |