Index: webrtc/pc/channelmanager.cc |
diff --git a/webrtc/pc/channelmanager.cc b/webrtc/pc/channelmanager.cc |
index af6e3c7e99e16f9780c4872ee8384a2d006e71df..1817f6923334a896649dd5848ee628a05b3e9c3f 100644 |
--- a/webrtc/pc/channelmanager.cc |
+++ b/webrtc/pc/channelmanager.cc |
@@ -89,21 +89,33 @@ bool ChannelManager::SetVideoRtxEnabled(bool enable) { |
void ChannelManager::GetSupportedAudioSendCodecs( |
std::vector<AudioCodec>* codecs) const { |
+ if (!media_engine_) { |
+ return; |
+ } |
*codecs = media_engine_->audio_send_codecs(); |
} |
void ChannelManager::GetSupportedAudioReceiveCodecs( |
std::vector<AudioCodec>* codecs) const { |
+ if (!media_engine_) { |
+ return; |
+ } |
*codecs = media_engine_->audio_recv_codecs(); |
} |
void ChannelManager::GetSupportedAudioRtpHeaderExtensions( |
RtpHeaderExtensions* ext) const { |
+ if (!media_engine_) { |
+ return; |
+ } |
*ext = media_engine_->GetAudioCapabilities().header_extensions; |
} |
void ChannelManager::GetSupportedVideoCodecs( |
std::vector<VideoCodec>* codecs) const { |
+ if (!media_engine_) { |
+ return; |
+ } |
codecs->clear(); |
std::vector<VideoCodec> video_codecs = media_engine_->video_codecs(); |
@@ -118,11 +130,17 @@ void ChannelManager::GetSupportedVideoCodecs( |
void ChannelManager::GetSupportedVideoRtpHeaderExtensions( |
RtpHeaderExtensions* ext) const { |
+ if (!media_engine_) { |
+ return; |
+ } |
*ext = media_engine_->GetVideoCapabilities().header_extensions; |
} |
void ChannelManager::GetSupportedDataCodecs( |
std::vector<DataCodec>* codecs) const { |
+ if (!data_media_engine_) { |
+ return; |
+ } |
*codecs = data_media_engine_->data_codecs(); |
} |
@@ -148,7 +166,10 @@ bool ChannelManager::Init() { |
bool ChannelManager::InitMediaEngine_w() { |
RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); |
- return media_engine_->Init(); |
+ if (media_engine_) { |
+ return media_engine_->Init(); |
+ } |
+ return true; |
} |
void ChannelManager::Terminate() { |
@@ -223,6 +244,9 @@ VoiceChannel* ChannelManager::CreateVoiceChannel_w( |
RTC_DCHECK(initialized_); |
RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); |
RTC_DCHECK(nullptr != call); |
+ if (!media_engine_) { |
+ return nullptr; |
+ } |
VoiceMediaChannel* media_channel = media_engine_->CreateChannel( |
call, media_config, options); |