- Remove AudioTrackRenderer.
- Remove AddChannel/RemoveChannel from AudioRenderer interface.
BUG=webrtc:4690
Review URL: https://codereview.webrtc.org/1399553003
Cr-Commit-Position: refs/heads/master@{#10226}
diff --git a/talk/app/webrtc/audiotrackrenderer.cc b/talk/app/webrtc/audiotrackrenderer.cc
deleted file mode 100644
index 264a3cb..0000000
--- a/talk/app/webrtc/audiotrackrenderer.cc
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * libjingle
- * Copyright 2013 Google Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "talk/app/webrtc/audiotrackrenderer.h"
-#include "webrtc/base/common.h"
-
-namespace webrtc {
-
-AudioTrackRenderer::AudioTrackRenderer() : channel_id_(-1) {
-}
-
-AudioTrackRenderer::~AudioTrackRenderer() {
-}
-
-void AudioTrackRenderer::AddChannel(int channel_id) {
- ASSERT(channel_id_ == -1 || channel_id_ == channel_id);
- channel_id_ = channel_id;
-}
-
-void AudioTrackRenderer::RemoveChannel(int channel_id) {
- ASSERT(channel_id_ == -1 || channel_id_ == channel_id);
- channel_id_ = -1;
-}
-
-} // namespace webrtc
diff --git a/talk/app/webrtc/audiotrackrenderer.h b/talk/app/webrtc/audiotrackrenderer.h
deleted file mode 100644
index e22805f..0000000
--- a/talk/app/webrtc/audiotrackrenderer.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * libjingle
- * Copyright 2013 Google Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef TALK_APP_WEBRTC_AUDIOTRACKRENDERER_H_
-#define TALK_APP_WEBRTC_AUDIOTRACKRENDERER_H_
-
-#include "talk/media/base/audiorenderer.h"
-#include "webrtc/base/thread.h"
-
-namespace webrtc {
-
-// Class used for AudioTrack to get the ID of WebRtc voice channel that
-// the AudioTrack is connecting to.
-// Each AudioTrack owns a AudioTrackRenderer instance.
-// AddChannel() will be called when an AudioTrack is added to a MediaStream.
-// RemoveChannel will be called when the AudioTrack or WebRtc VoE channel is
-// going away.
-// This implementation only supports one channel, and it is only used by
-// Chrome for remote audio tracks."
-class AudioTrackRenderer : public cricket::AudioRenderer {
- public:
- AudioTrackRenderer();
- ~AudioTrackRenderer();
-
- // Implements cricket::AudioRenderer.
- void AddChannel(int channel_id) override;
- void RemoveChannel(int channel_id) override;
-
- private:
- int channel_id_;
-};
-
-} // namespace webrtc
-
-#endif // TALK_APP_WEBRTC_AUDIOTRACKRENDERER_H_
diff --git a/talk/app/webrtc/webrtcsession_unittest.cc b/talk/app/webrtc/webrtcsession_unittest.cc
index 2853ca4..ff41383 100644
--- a/talk/app/webrtc/webrtcsession_unittest.cc
+++ b/talk/app/webrtc/webrtcsession_unittest.cc
@@ -330,26 +330,16 @@
class FakeAudioRenderer : public cricket::AudioRenderer {
public:
- FakeAudioRenderer() : channel_id_(-1), sink_(NULL) {}
+ FakeAudioRenderer() : sink_(NULL) {}
virtual ~FakeAudioRenderer() {
if (sink_)
sink_->OnClose();
}
- void AddChannel(int channel_id) override {
- ASSERT(channel_id_ == -1);
- channel_id_ = channel_id;
- }
- void RemoveChannel(int channel_id) override {
- ASSERT(channel_id == channel_id_);
- channel_id_ = -1;
- }
void SetSink(Sink* sink) override { sink_ = sink; }
- int channel_id() const { return channel_id_; }
cricket::AudioRenderer::Sink* sink() const { return sink_; }
private:
- int channel_id_;
cricket::AudioRenderer::Sink* sink_;
};
@@ -3117,12 +3107,10 @@
EXPECT_TRUE(channel->GetOutputScaling(receive_ssrc, &left_vol, &right_vol));
EXPECT_EQ(0, left_vol);
EXPECT_EQ(0, right_vol);
- EXPECT_EQ(0, renderer->channel_id());
session_->SetAudioPlayout(receive_ssrc, true, NULL);
EXPECT_TRUE(channel->GetOutputScaling(receive_ssrc, &left_vol, &right_vol));
EXPECT_EQ(1, left_vol);
EXPECT_EQ(1, right_vol);
- EXPECT_EQ(-1, renderer->channel_id());
}
TEST_F(WebRtcSessionTest, SetAudioSend) {
@@ -3142,7 +3130,6 @@
session_->SetAudioSend(send_ssrc, false, options, renderer.get());
EXPECT_TRUE(channel->IsStreamMuted(send_ssrc));
EXPECT_FALSE(channel->options().echo_cancellation.IsSet());
- EXPECT_EQ(0, renderer->channel_id());
EXPECT_TRUE(renderer->sink() != NULL);
// This will trigger SetSink(NULL) to the |renderer|.
@@ -3151,7 +3138,6 @@
bool value;
EXPECT_TRUE(channel->options().echo_cancellation.Get(&value));
EXPECT_TRUE(value);
- EXPECT_EQ(-1, renderer->channel_id());
EXPECT_TRUE(renderer->sink() == NULL);
}
diff --git a/talk/libjingle.gyp b/talk/libjingle.gyp
index fd2d969..3268d01 100755
--- a/talk/libjingle.gyp
+++ b/talk/libjingle.gyp
@@ -712,8 +712,6 @@
'sources': [
'app/webrtc/audiotrack.cc',
'app/webrtc/audiotrack.h',
- 'app/webrtc/audiotrackrenderer.cc',
- 'app/webrtc/audiotrackrenderer.h',
'app/webrtc/datachannel.cc',
'app/webrtc/datachannel.h',
'app/webrtc/datachannelinterface.h',
diff --git a/talk/media/base/audiorenderer.h b/talk/media/base/audiorenderer.h
index 5c03576..229c36e 100644
--- a/talk/media/base/audiorenderer.h
+++ b/talk/media/base/audiorenderer.h
@@ -55,20 +55,6 @@
// to the renderer at a time.
virtual void SetSink(Sink* sink) {}
- // Add the WebRtc VoE channel to the renderer.
- // For local stream, multiple WebRtc VoE channels can be connected to the
- // renderer. While for remote stream, only one WebRtc VoE channel can be
- // connected to the renderer.
- // TODO(xians): Remove this interface after Chrome switches to the
- // AudioRenderer::Sink interface.
- virtual void AddChannel(int channel_id) {}
-
- // Remove the WebRtc VoE channel from the renderer.
- // This method is called when the VoE channel is going away.
- // TODO(xians): Remove this interface after Chrome switches to the
- // AudioRenderer::Sink interface.
- virtual void RemoveChannel(int channel_id) {}
-
protected:
virtual ~AudioRenderer() {}
};
diff --git a/talk/media/base/fakemediaengine.h b/talk/media/base/fakemediaengine.h
index 7325667..e5c4c53 100644
--- a/talk/media/base/fakemediaengine.h
+++ b/talk/media/base/fakemediaengine.h
@@ -308,11 +308,9 @@
ASSERT(it->second == renderer);
} else {
remote_renderers_.insert(std::make_pair(ssrc, renderer));
- renderer->AddChannel(0);
}
} else {
if (it != remote_renderers_.end()) {
- it->second->RemoveChannel(0);
remote_renderers_.erase(it);
} else {
return false;
@@ -382,12 +380,10 @@
public:
explicit VoiceChannelAudioSink(AudioRenderer* renderer)
: renderer_(renderer) {
- renderer_->AddChannel(0);
renderer_->SetSink(this);
}
virtual ~VoiceChannelAudioSink() {
if (renderer_) {
- renderer_->RemoveChannel(0);
renderer_->SetSink(NULL);
}
}
diff --git a/talk/media/webrtc/webrtcvoiceengine.cc b/talk/media/webrtc/webrtcvoiceengine.cc
index 54fac22..db22b41 100644
--- a/talk/media/webrtc/webrtcvoiceengine.cc
+++ b/talk/media/webrtc/webrtcvoiceengine.cc
@@ -1305,10 +1305,6 @@
RTC_DCHECK(renderer_ == renderer);
return;
}
-
- // TODO(xians): Remove AddChannel() call after Chrome turns on APM
- // in getUserMedia by default.
- renderer->AddChannel(channel_);
renderer->SetSink(this);
renderer_ = renderer;
}
@@ -1318,12 +1314,10 @@
// This method is called on the libjingle worker thread.
void Stop() {
rtc::CritScope lock(&lock_);
- if (renderer_ == NULL)
- return;
-
- renderer_->RemoveChannel(channel_);
- renderer_->SetSink(NULL);
- renderer_ = NULL;
+ if (renderer_ != NULL) {
+ renderer_->SetSink(NULL);
+ renderer_ = NULL;
+ }
}
// AudioRenderer::Sink implementation.