Fix bug causing audio to stop being sent when AudioSendStreams are recreated.

BUG=webrtc:5772

Review URL: https://codereview.webrtc.org/1881793006

Cr-Commit-Position: refs/heads/master@{#12347}
This commit is contained in:
solenberg 2016-04-13 09:07:30 -07:00 committed by Commit bot
parent 21a395ddf7
commit 6d6e7c5e1a
2 changed files with 26 additions and 0 deletions

View File

@ -1121,6 +1121,7 @@ class WebRtcVoiceMediaChannel::WebRtcAudioSendStream
RTC_DCHECK(!stream_);
stream_ = call_->CreateAudioSendStream(config_);
RTC_CHECK(stream_);
UpdateSendState();
}
bool SendTelephoneEvent(int payload_type, int event, int duration_ms) {

View File

@ -2176,6 +2176,31 @@ TEST_F(WebRtcVoiceEngineTestFake, SendStateWithAndWithoutSource) {
EXPECT_FALSE(GetSendStream(kSsrc1).IsSending());
}
// Test that SetSendParameters() does not alter a stream's send state.
TEST_F(WebRtcVoiceEngineTestFake, SendStateWhenStreamsAreRecreated) {
EXPECT_TRUE(SetupSendStream());
EXPECT_FALSE(GetSendStream(kSsrc1).IsSending());
// Turn on sending.
channel_->SetSend(true);
EXPECT_TRUE(GetSendStream(kSsrc1).IsSending());
// Changing RTP header extensions will recreate the AudioSendStream.
send_parameters_.extensions.push_back(
cricket::RtpHeaderExtension(kRtpAudioLevelHeaderExtension, 12));
EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
EXPECT_TRUE(GetSendStream(kSsrc1).IsSending());
// Turn off sending.
channel_->SetSend(false);
EXPECT_FALSE(GetSendStream(kSsrc1).IsSending());
// Changing RTP header extensions will recreate the AudioSendStream.
send_parameters_.extensions.clear();
EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
EXPECT_FALSE(GetSendStream(kSsrc1).IsSending());
}
// Test that we can create a channel and start playing out on it.
TEST_F(WebRtcVoiceEngineTestFake, Playout) {
EXPECT_TRUE(SetupRecvStream());