- Rename VoiceChannel::MuteStream() -> SetAudioSend() (incl. media channel)
- Rename VideoChannel::MuteStream() -> SetVideoSend() (incl. media channel)
- Collapse NnChannel::SetChannelOptions() into the above.
- Collapse VoiceChannel::SetLocalRenderer into SetAudioSend().
BUG=webrtc:4690
Review URL: https://codereview.webrtc.org/1311533009
Cr-Commit-Position: refs/heads/master@{#9915}
diff --git a/talk/media/base/fakemediaengine.h b/talk/media/base/fakemediaengine.h
index 47ec402..56986c5 100644
--- a/talk/media/base/fakemediaengine.h
+++ b/talk/media/base/fakemediaengine.h
@@ -137,15 +137,6 @@
virtual bool RemoveRecvStream(uint32 ssrc) {
return RemoveStreamBySsrc(&receive_streams_, ssrc);
}
- virtual bool MuteStream(uint32 ssrc, bool on) {
- if (!HasSendStream(ssrc) && ssrc != 0)
- return false;
- if (on)
- muted_streams_.insert(ssrc);
- else
- muted_streams_.erase(ssrc);
- return true;
- }
bool IsStreamMuted(uint32 ssrc) const {
bool ret = muted_streams_.find(ssrc) != muted_streams_.end();
// If |ssrc = 0| check if the first send stream is muted.
@@ -188,6 +179,15 @@
}
protected:
+ bool MuteStream(uint32 ssrc, bool mute) {
+ if (!HasSendStream(ssrc) && ssrc != 0)
+ return false;
+ if (mute)
+ muted_streams_.insert(ssrc);
+ else
+ muted_streams_.erase(ssrc);
+ return true;
+ }
bool set_sending(bool send) {
sending_ = send;
return true;
@@ -283,6 +283,20 @@
}
return set_sending(flag != SEND_NOTHING);
}
+ virtual bool SetAudioSend(uint32 ssrc, bool mute,
+ const AudioOptions* options,
+ AudioRenderer* renderer) {
+ if (!SetLocalRenderer(ssrc, renderer)) {
+ return false;
+ }
+ if (!RtpHelper<VoiceMediaChannel>::MuteStream(ssrc, mute)) {
+ return false;
+ }
+ if (!mute && options) {
+ return SetOptions(*options);
+ }
+ return true;
+ }
virtual bool SetMaxSendBandwidth(int bps) { return true; }
virtual bool AddRecvStream(const StreamParams& sp) {
if (!RtpHelper<VoiceMediaChannel>::AddRecvStream(sp))
@@ -316,26 +330,6 @@
}
return true;
}
- virtual bool SetLocalRenderer(uint32 ssrc, AudioRenderer* renderer) {
- std::map<uint32, VoiceChannelAudioSink*>::iterator it =
- local_renderers_.find(ssrc);
- if (renderer) {
- if (it != local_renderers_.end()) {
- ASSERT(it->second->renderer() == renderer);
- } else {
- local_renderers_.insert(std::make_pair(
- ssrc, new VoiceChannelAudioSink(renderer)));
- }
- } else {
- if (it != local_renderers_.end()) {
- delete it->second;
- local_renderers_.erase(it);
- } else {
- return false;
- }
- }
- return true;
- }
virtual bool GetActiveStreams(AudioInfo::StreamList* streams) { return true; }
virtual int GetOutputLevel() { return 0; }
@@ -442,6 +436,23 @@
AudioRenderer* renderer_;
};
+ bool SetLocalRenderer(uint32 ssrc, AudioRenderer* renderer) {
+ auto it = local_renderers_.find(ssrc);
+ if (renderer) {
+ if (it != local_renderers_.end()) {
+ ASSERT(it->second->renderer() == renderer);
+ } else {
+ local_renderers_.insert(std::make_pair(
+ ssrc, new VoiceChannelAudioSink(renderer)));
+ }
+ } else {
+ if (it != local_renderers_.end()) {
+ delete it->second;
+ local_renderers_.erase(it);
+ }
+ }
+ return true;
+ }
FakeVoiceEngine* engine_;
std::vector<AudioCodec> recv_codecs_;
@@ -556,6 +567,17 @@
}
virtual bool SetSend(bool send) { return set_sending(send); }
+ virtual bool SetVideoSend(uint32 ssrc, bool mute,
+ const VideoOptions* options) {
+ if (!RtpHelper<VideoMediaChannel>::MuteStream(ssrc, mute)) {
+ return false;
+ }
+ if (!mute && options) {
+ return SetOptions(*options);
+ } else {
+ return true;
+ }
+ }
virtual bool SetCapturer(uint32 ssrc, VideoCapturer* capturer) {
capturers_[ssrc] = capturer;
return true;