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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/engine/webrtcvoiceengine_unittest.cc
diff --git a/webrtc/media/engine/webrtcvoiceengine_unittest.cc b/webrtc/media/engine/webrtcvoiceengine_unittest.cc
index c55389ae7361d9beaa4e8a1469a732019836e943..0bb350133933a0fc477b0644b620337535999990 100644
--- a/webrtc/media/engine/webrtcvoiceengine_unittest.cc
+++ b/webrtc/media/engine/webrtcvoiceengine_unittest.cc
@@ -2814,6 +2814,50 @@ TEST_F(WebRtcVoiceEngineTestFake, RecvUnsignalledAfterSignalled) {
EXPECT_EQ(2, call_.GetAudioReceiveStreams().size());
}
+// Two tests to verify that adding a receive stream with the same SSRC as a
+// previously added unsignaled stream will only recreate underlying stream
+// objects if the stream parameters have changed.
+TEST_F(WebRtcVoiceEngineTestFake, AddRecvStreamAfterUnsignaled_NoRecreate) {
+ EXPECT_TRUE(SetupChannel());
+
+ // Spawn unsignaled stream with SSRC=1.
+ DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame));
+ EXPECT_EQ(1, call_.GetAudioReceiveStreams().size());
+ EXPECT_TRUE(GetRecvStream(1).VerifyLastPacket(kPcmuFrame,
+ sizeof(kPcmuFrame)));
+
+ // Verify that the underlying stream object in Call is not recreated when a
+ // stream with SSRC=1 is added.
+ const auto& streams = call_.GetAudioReceiveStreams();
+ EXPECT_EQ(1, streams.size());
+ int audio_receive_stream_id = streams.front()->id();
+ EXPECT_TRUE(AddRecvStream(1));
+ EXPECT_EQ(1, streams.size());
+ EXPECT_EQ(audio_receive_stream_id, streams.front()->id());
+}
+
+TEST_F(WebRtcVoiceEngineTestFake, AddRecvStreamAfterUnsignaled_Recreate) {
+ EXPECT_TRUE(SetupChannel());
+
+ // Spawn unsignaled stream with SSRC=1.
+ DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame));
+ EXPECT_EQ(1, call_.GetAudioReceiveStreams().size());
+ EXPECT_TRUE(GetRecvStream(1).VerifyLastPacket(kPcmuFrame,
+ sizeof(kPcmuFrame)));
+
+ // Verify that the underlying stream object in Call *is* recreated when a
+ // stream with SSRC=1 is added, and which has changed stream parameters.
+ const auto& streams = call_.GetAudioReceiveStreams();
+ EXPECT_EQ(1, streams.size());
+ int audio_receive_stream_id = streams.front()->id();
+ cricket::StreamParams stream_params;
+ stream_params.ssrcs.push_back(1);
+ stream_params.sync_label = "sync_label";
+ EXPECT_TRUE(channel_->AddRecvStream(stream_params));
+ EXPECT_EQ(1, streams.size());
+ EXPECT_NE(audio_receive_stream_id, streams.front()->id());
+}
+
// Test that we properly handle failures to add a receive stream.
TEST_F(WebRtcVoiceEngineTestFake, AddRecvStreamFail) {
EXPECT_TRUE(SetupChannel());
« 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