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

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

Issue 1881793006: Fix bug causing audio to stop being sent when AudioSendStreams are recreated. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Better test case Created 4 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 | « 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 2158 matching lines...) Expand 10 before | Expand all | Expand 10 after
2169 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 2169 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
2170 EXPECT_TRUE(channel_->SetAudioSend(kSsrc1, true, nullptr, nullptr)); 2170 EXPECT_TRUE(channel_->SetAudioSend(kSsrc1, true, nullptr, nullptr));
2171 channel_->SetSend(true); 2171 channel_->SetSend(true);
2172 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending()); 2172 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending());
2173 EXPECT_TRUE(channel_->SetAudioSend(kSsrc1, true, nullptr, &fake_source_)); 2173 EXPECT_TRUE(channel_->SetAudioSend(kSsrc1, true, nullptr, &fake_source_));
2174 EXPECT_TRUE(GetSendStream(kSsrc1).IsSending()); 2174 EXPECT_TRUE(GetSendStream(kSsrc1).IsSending());
2175 EXPECT_TRUE(channel_->SetAudioSend(kSsrc1, true, nullptr, nullptr)); 2175 EXPECT_TRUE(channel_->SetAudioSend(kSsrc1, true, nullptr, nullptr));
2176 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending()); 2176 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending());
2177 } 2177 }
2178 2178
2179 // Test that SetSendParameters() does not alter a stream's send state.
2180 TEST_F(WebRtcVoiceEngineTestFake, SendStateWhenStreamsAreRecreated) {
2181 EXPECT_TRUE(SetupSendStream());
2182 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending());
2183
2184 // Turn on sending.
2185 channel_->SetSend(true);
2186 EXPECT_TRUE(GetSendStream(kSsrc1).IsSending());
2187
2188 // Changing RTP header extensions will recreate the AudioSendStream.
2189 send_parameters_.extensions.push_back(
2190 cricket::RtpHeaderExtension(kRtpAudioLevelHeaderExtension, 12));
2191 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
2192 EXPECT_TRUE(GetSendStream(kSsrc1).IsSending());
2193
2194 // Turn off sending.
2195 channel_->SetSend(false);
2196 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending());
2197
2198 // Changing RTP header extensions will recreate the AudioSendStream.
2199 send_parameters_.extensions.clear();
2200 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
2201 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending());
2202 }
2203
2179 // Test that we can create a channel and start playing out on it. 2204 // Test that we can create a channel and start playing out on it.
2180 TEST_F(WebRtcVoiceEngineTestFake, Playout) { 2205 TEST_F(WebRtcVoiceEngineTestFake, Playout) {
2181 EXPECT_TRUE(SetupRecvStream()); 2206 EXPECT_TRUE(SetupRecvStream());
2182 int channel_num = voe_.GetLastChannel(); 2207 int channel_num = voe_.GetLastChannel();
2183 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_)); 2208 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_));
2184 EXPECT_TRUE(channel_->SetPlayout(true)); 2209 EXPECT_TRUE(channel_->SetPlayout(true));
2185 EXPECT_TRUE(voe_.GetPlayout(channel_num)); 2210 EXPECT_TRUE(voe_.GetPlayout(channel_num));
2186 EXPECT_TRUE(channel_->SetPlayout(false)); 2211 EXPECT_TRUE(channel_->SetPlayout(false));
2187 EXPECT_FALSE(voe_.GetPlayout(channel_num)); 2212 EXPECT_FALSE(voe_.GetPlayout(channel_num));
2188 } 2213 }
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
3493 TEST(WebRtcVoiceEngineTest, SetRecvCodecs) { 3518 TEST(WebRtcVoiceEngineTest, SetRecvCodecs) {
3494 cricket::WebRtcVoiceEngine engine(nullptr); 3519 cricket::WebRtcVoiceEngine engine(nullptr);
3495 std::unique_ptr<webrtc::Call> call( 3520 std::unique_ptr<webrtc::Call> call(
3496 webrtc::Call::Create(webrtc::Call::Config())); 3521 webrtc::Call::Create(webrtc::Call::Config()));
3497 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), 3522 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(),
3498 cricket::AudioOptions(), call.get()); 3523 cricket::AudioOptions(), call.get());
3499 cricket::AudioRecvParameters parameters; 3524 cricket::AudioRecvParameters parameters;
3500 parameters.codecs = engine.codecs(); 3525 parameters.codecs = engine.codecs();
3501 EXPECT_TRUE(channel.SetRecvParameters(parameters)); 3526 EXPECT_TRUE(channel.SetRecvParameters(parameters));
3502 } 3527 }
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