Get rid of media_engine_ from BaseChannel; only VoiceChannel needs it.
BUG=webrtc:4690
R=tommi@webrtc.org
Review URL: https://codereview.webrtc.org/1270333002 .
Cr-Commit-Position: refs/heads/master@{#9679}
diff --git a/talk/app/webrtc/statscollector_unittest.cc b/talk/app/webrtc/statscollector_unittest.cc
index 315366c..ab9181f 100644
--- a/talk/app/webrtc/statscollector_unittest.cc
+++ b/talk/app/webrtc/statscollector_unittest.cc
@@ -800,7 +800,7 @@
MockVideoMediaChannel* media_channel = new MockVideoMediaChannel();
cricket::VideoChannel video_channel(rtc::Thread::Current(),
- media_engine_, media_channel, NULL, kVideoChannelName, false);
+ media_channel, NULL, kVideoChannelName, false);
StatsReports reports; // returned values.
cricket::VideoSenderInfo video_sender_info;
cricket::VideoMediaInfo stats_read;
@@ -843,7 +843,7 @@
MockVideoMediaChannel* media_channel = new MockVideoMediaChannel();
cricket::VideoChannel video_channel(rtc::Thread::Current(),
- media_engine_, media_channel, NULL, kVideoChannelName, false);
+ media_channel, NULL, kVideoChannelName, false);
StatsReports reports; // returned values.
cricket::VideoSenderInfo video_sender_info;
@@ -922,7 +922,7 @@
MockVideoMediaChannel* media_channel = new MockVideoMediaChannel();
cricket::VideoChannel video_channel(rtc::Thread::Current(),
- media_engine_, media_channel, NULL, "video", false);
+ media_channel, NULL, "video", false);
AddOutgoingVideoTrackStats();
stats.AddStream(stream_);
@@ -955,7 +955,7 @@
MockVideoMediaChannel* media_channel = new MockVideoMediaChannel();
cricket::VideoChannel video_channel(rtc::Thread::Current(),
- media_engine_, media_channel, NULL, kVideoChannelName, false);
+ media_channel, NULL, kVideoChannelName, false);
AddOutgoingVideoTrackStats();
stats.AddStream(stream_);
@@ -1017,7 +1017,7 @@
// The content_name known by the video channel.
const std::string kVcName("vcname");
cricket::VideoChannel video_channel(rtc::Thread::Current(),
- media_engine_, media_channel, NULL, kVcName, false);
+ media_channel, NULL, kVcName, false);
AddOutgoingVideoTrackStats();
stats.AddStream(stream_);
@@ -1075,7 +1075,7 @@
// The content_name known by the video channel.
const std::string kVcName("vcname");
cricket::VideoChannel video_channel(rtc::Thread::Current(),
- media_engine_, media_channel, NULL, kVcName, false);
+ media_channel, NULL, kVcName, false);
AddOutgoingVideoTrackStats();
stats.AddStream(stream_);
@@ -1102,7 +1102,7 @@
// The content_name known by the video channel.
const std::string kVcName("vcname");
cricket::VideoChannel video_channel(rtc::Thread::Current(),
- media_engine_, media_channel, NULL, kVcName, false);
+ media_channel, NULL, kVcName, false);
AddOutgoingVideoTrackStats();
stats.AddStream(stream_);
@@ -1154,7 +1154,7 @@
MockVideoMediaChannel* media_channel = new MockVideoMediaChannel();
cricket::VideoChannel video_channel(rtc::Thread::Current(),
- media_engine_, media_channel, NULL, kVideoChannelName, false);
+ media_channel, NULL, kVideoChannelName, false);
AddIncomingVideoTrackStats();
stats.AddStream(stream_);
diff --git a/talk/session/media/channel.cc b/talk/session/media/channel.cc
index 4aa2d7b..dc7a478 100644
--- a/talk/session/media/channel.cc
+++ b/talk/session/media/channel.cc
@@ -151,11 +151,9 @@
}
BaseChannel::BaseChannel(rtc::Thread* thread,
- MediaEngineInterface* media_engine,
MediaChannel* media_channel, BaseSession* session,
const std::string& content_name, bool rtcp)
: worker_thread_(thread),
- media_engine_(media_engine),
session_(session),
media_channel_(media_channel),
content_name_(content_name),
@@ -1295,8 +1293,9 @@
BaseSession* session,
const std::string& content_name,
bool rtcp)
- : BaseChannel(thread, media_engine, media_channel, session, content_name,
+ : BaseChannel(thread, media_channel, session, content_name,
rtcp),
+ media_engine_(media_engine),
received_media_(false) {
}
@@ -1439,7 +1438,7 @@
}
int VoiceChannel::GetInputLevel_w() {
- return media_engine()->GetInputLevel();
+ return media_engine_->GetInputLevel();
}
int VoiceChannel::GetOutputLevel_w() {
@@ -1685,12 +1684,11 @@
}
VideoChannel::VideoChannel(rtc::Thread* thread,
- MediaEngineInterface* media_engine,
VideoMediaChannel* media_channel,
BaseSession* session,
const std::string& content_name,
bool rtcp)
- : BaseChannel(thread, media_engine, media_channel, session, content_name,
+ : BaseChannel(thread, media_channel, session, content_name,
rtcp),
renderer_(NULL),
previous_we_(rtc::WE_CLOSE) {
@@ -2128,8 +2126,7 @@
BaseSession* session,
const std::string& content_name,
bool rtcp)
- // MediaEngine is NULL
- : BaseChannel(thread, NULL, media_channel, session, content_name, rtcp),
+ : BaseChannel(thread, media_channel, session, content_name, rtcp),
data_channel_type_(cricket::DCT_NONE),
ready_to_send_data_(false) {
}
diff --git a/talk/session/media/channel.h b/talk/session/media/channel.h
index bb2dffd..420141c 100644
--- a/talk/session/media/channel.h
+++ b/talk/session/media/channel.h
@@ -76,8 +76,7 @@
public MediaChannel::NetworkInterface,
public ConnectionStatsGetter {
public:
- BaseChannel(rtc::Thread* thread, MediaEngineInterface* media_engine,
- MediaChannel* channel, BaseSession* session,
+ BaseChannel(rtc::Thread* thread, MediaChannel* channel, BaseSession* session,
const std::string& content_name, bool rtcp);
virtual ~BaseChannel();
bool Init();
@@ -174,7 +173,6 @@
virtual int SetOption(SocketType type, rtc::Socket::Option o, int val);
protected:
- MediaEngineInterface* media_engine() const { return media_engine_; }
virtual MediaChannel* media_channel() const { return media_channel_; }
// Sets the transport_channel_ and rtcp_transport_channel_. If
// |rtcp| is false, set rtcp_transport_channel_ is set to NULL. Get
@@ -312,7 +310,6 @@
private:
rtc::Thread* worker_thread_;
- MediaEngineInterface* media_engine_;
BaseSession* session_;
MediaChannel* media_channel_;
std::vector<StreamParams> local_streams_;
@@ -444,6 +441,7 @@
void OnSrtpError(uint32 ssrc, SrtpFilter::Mode mode, SrtpFilter::Error error);
static const int kEarlyMediaTimeout = 1000;
+ MediaEngineInterface* media_engine_;
bool received_media_;
rtc::scoped_ptr<VoiceMediaMonitor> media_monitor_;
rtc::scoped_ptr<AudioMonitor> audio_monitor_;
@@ -453,9 +451,9 @@
// VideoChannel is a specialization for video.
class VideoChannel : public BaseChannel {
public:
- VideoChannel(rtc::Thread* thread, MediaEngineInterface* media_engine,
- VideoMediaChannel* channel, BaseSession* session,
- const std::string& content_name, bool rtcp);
+ VideoChannel(rtc::Thread* thread, VideoMediaChannel* channel,
+ BaseSession* session, const std::string& content_name,
+ bool rtcp);
~VideoChannel();
bool Init();
diff --git a/talk/session/media/channel_unittest.cc b/talk/session/media/channel_unittest.cc
index 76cabd6..84a14e1 100644
--- a/talk/session/media/channel_unittest.cc
+++ b/talk/session/media/channel_unittest.cc
@@ -1880,7 +1880,7 @@
cricket::FakeVideoMediaChannel* ch, cricket::BaseSession* session,
bool rtcp) {
cricket::VideoChannel* channel = new cricket::VideoChannel(
- thread, engine, ch, session, cricket::CN_VIDEO, rtcp);
+ thread, ch, session, cricket::CN_VIDEO, rtcp);
if (!channel->Init()) {
delete channel;
channel = NULL;
diff --git a/talk/session/media/channelmanager.cc b/talk/session/media/channelmanager.cc
index 52116dd..f3c43d0 100644
--- a/talk/session/media/channelmanager.cc
+++ b/talk/session/media/channelmanager.cc
@@ -422,7 +422,7 @@
return NULL;
VideoChannel* video_channel = new VideoChannel(
- worker_thread_, media_engine_.get(), media_channel,
+ worker_thread_, media_channel,
session, content_name, rtcp);
if (!video_channel->Init()) {
delete video_channel;