Index: webrtc/pc/channelmanager.cc |
diff --git a/webrtc/pc/channelmanager.cc b/webrtc/pc/channelmanager.cc |
index af6e3c7e99e16f9780c4872ee8384a2d006e71df..b649c3b81dbadccd9bf47126adb791c6c2ab6834 100644 |
--- a/webrtc/pc/channelmanager.cc |
+++ b/webrtc/pc/channelmanager.cc |
@@ -89,21 +89,41 @@ bool ChannelManager::SetVideoRtxEnabled(bool enable) { |
void ChannelManager::GetSupportedAudioSendCodecs( |
std::vector<AudioCodec>* codecs) const { |
+ if (!media_engine_) { |
+ LOG(LS_WARNING) << "Failed to get supported audio sending codecs because " |
+ "the media_engine_ is unset."; |
Taylor Brandstetter
2017/05/30 17:30:53
Will this occur during normal circumstances in a d
Zhi Huang
2017/05/31 00:03:29
I'll remove these.
|
+ return; |
+ } |
*codecs = media_engine_->audio_send_codecs(); |
} |
void ChannelManager::GetSupportedAudioReceiveCodecs( |
std::vector<AudioCodec>* codecs) const { |
+ if (!media_engine_) { |
+ LOG(LS_WARNING) << "Failed to get supported audio receiving codecs because " |
+ "the media_engine_ is unset."; |
+ return; |
+ } |
*codecs = media_engine_->audio_recv_codecs(); |
} |
void ChannelManager::GetSupportedAudioRtpHeaderExtensions( |
RtpHeaderExtensions* ext) const { |
+ if (!media_engine_) { |
+ LOG(LS_WARNING) << "Failed to get audio RTP header extensions because the " |
+ "media_engine_ is unset."; |
+ return; |
+ } |
*ext = media_engine_->GetAudioCapabilities().header_extensions; |
} |
void ChannelManager::GetSupportedVideoCodecs( |
std::vector<VideoCodec>* codecs) const { |
+ if (!media_engine_) { |
+ LOG(LS_WARNING) |
+ << "Failed to get video codecs because the media_engine_ is unset."; |
+ return; |
+ } |
codecs->clear(); |
std::vector<VideoCodec> video_codecs = media_engine_->video_codecs(); |
@@ -118,11 +138,21 @@ void ChannelManager::GetSupportedVideoCodecs( |
void ChannelManager::GetSupportedVideoRtpHeaderExtensions( |
RtpHeaderExtensions* ext) const { |
+ if (!media_engine_) { |
+ LOG(LS_WARNING) << "Failed to get video RTP header extensions because the " |
+ "media_engine_ is unset."; |
+ return; |
+ } |
*ext = media_engine_->GetVideoCapabilities().header_extensions; |
} |
void ChannelManager::GetSupportedDataCodecs( |
std::vector<DataCodec>* codecs) const { |
+ if (!data_media_engine_) { |
+ LOG(LS_WARNING) << "Failed to get supported data codecs because the " |
+ "data_media_engine_ is unset."; |
+ return; |
+ } |
*codecs = data_media_engine_->data_codecs(); |
} |
@@ -148,7 +178,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 +256,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); |