Make sure that muting muted streams succeeds.

We don't want to report an error here, and PeerConnection relies on
being able to mute already-muted streams (I hit an assert when testing
manually).

BUG=1788
R=pthatcher@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/14139004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6895 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org 2014-08-13 21:36:18 +00:00
parent 432893a100
commit ef8bb8d9b0
3 changed files with 13 additions and 5 deletions

View File

@ -1698,6 +1698,14 @@ class VideoMediaChannelTest : public testing::Test,
EXPECT_EQ_WAIT(frame_count, renderer_.num_rendered_frames(), kTimeout);
EXPECT_FALSE(renderer_.black_frame());
// Test that muting an existing stream succeeds even if it's muted.
EXPECT_TRUE(channel_->MuteStream(kSsrc, true));
EXPECT_TRUE(channel_->MuteStream(kSsrc, true));
// Test that unmuting an existing stream succeeds even if it's not muted.
EXPECT_TRUE(channel_->MuteStream(kSsrc, false));
EXPECT_TRUE(channel_->MuteStream(kSsrc, false));
// Test that muting an invalid stream fails.
EXPECT_FALSE(channel_->MuteStream(kSsrc+1, true));
EXPECT_TRUE(channel_->SetCapturer(kSsrc, NULL));

View File

@ -1181,7 +1181,9 @@ bool WebRtcVideoChannel2::MuteStream(uint32 ssrc, bool mute) {
LOG(LS_ERROR) << "No sending stream on ssrc " << ssrc;
return false;
}
return send_streams_[ssrc]->MuteStream(mute);
send_streams_[ssrc]->MuteStream(mute);
return true;
}
bool WebRtcVideoChannel2::SetRecvRtpHeaderExtensions(
@ -1472,11 +1474,9 @@ bool WebRtcVideoChannel2::WebRtcVideoSendStream::SetVideoFormat(
return true;
}
bool WebRtcVideoChannel2::WebRtcVideoSendStream::MuteStream(bool mute) {
void WebRtcVideoChannel2::WebRtcVideoSendStream::MuteStream(bool mute) {
rtc::CritScope cs(&lock_);
bool was_muted = muted_;
muted_ = mute;
return was_muted != mute;
}
bool WebRtcVideoChannel2::WebRtcVideoSendStream::DisconnectCapturer() {

View File

@ -304,7 +304,7 @@ class WebRtcVideoChannel2 : public rtc::MessageHandler,
void InputFrame(VideoCapturer* capturer, const VideoFrame* frame);
bool SetCapturer(VideoCapturer* capturer);
bool SetVideoFormat(const VideoFormat& format);
bool MuteStream(bool mute);
void MuteStream(bool mute);
bool DisconnectCapturer();
void Start();