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}
This commit is contained in:
Fredrik Solenberg 2015-08-05 12:25:22 +02:00
parent bd10ee8bd3
commit 0c0226408d
5 changed files with 20 additions and 25 deletions

View File

@ -800,7 +800,7 @@ TEST_F(StatsCollectorTest, BytesCounterHandles64Bits) {
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 @@ TEST_F(StatsCollectorTest, BandwidthEstimationInfoIsReported) {
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 @@ TEST_F(StatsCollectorTest, TrackObjectExistsWithoutUpdateStats) {
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 @@ TEST_F(StatsCollectorTest, TrackAndSsrcObjectExistAfterUpdateSsrcStats) {
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 @@ TEST_F(StatsCollectorTest, TransportObjectLinkedFromSsrcObject) {
// 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 @@ TEST_F(StatsCollectorTest, RemoteSsrcInfoIsAbsent) {
// 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 @@ TEST_F(StatsCollectorTest, RemoteSsrcInfoIsPresent) {
// 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 @@ TEST_F(StatsCollectorTest, ReportsFromRemoteTrack) {
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_);

View File

@ -151,11 +151,9 @@ static const MediaContentDescription* GetContentDescription(
}
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 @@ VoiceChannel::VoiceChannel(rtc::Thread* thread,
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 @@ bool VoiceChannel::MuteStream_w(uint32 ssrc, bool mute) {
}
int VoiceChannel::GetInputLevel_w() {
return media_engine()->GetInputLevel();
return media_engine_->GetInputLevel();
}
int VoiceChannel::GetOutputLevel_w() {
@ -1685,12 +1684,11 @@ void VoiceChannel::GetSrtpCiphers(std::vector<std::string>* ciphers) const {
}
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 @@ DataChannel::DataChannel(rtc::Thread* thread,
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) {
}

View File

@ -76,8 +76,7 @@ class BaseChannel
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 @@ class BaseChannel
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 @@ class BaseChannel
private:
rtc::Thread* worker_thread_;
MediaEngineInterface* media_engine_;
BaseSession* session_;
MediaChannel* media_channel_;
std::vector<StreamParams> local_streams_;
@ -444,6 +441,7 @@ class VoiceChannel : public BaseChannel {
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 @@ class VoiceChannel : public BaseChannel {
// 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();

View File

@ -1880,7 +1880,7 @@ cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel(
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;

View File

@ -422,7 +422,7 @@ VideoChannel* ChannelManager::CreateVideoChannel_w(
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;