cricket::StreamParams stream_out;
const cricket::ContentInfo* audio_info =
cricket::GetFirstAudioContent(session_description);
- if (!audio_info) {
- return false;
- }
- const cricket::MediaContentDescription* audio_content =
- static_cast<const cricket::MediaContentDescription*>(
- audio_info->description);
-
- if (cricket::GetStreamBySsrc(audio_content->streams(), ssrc, &stream_out)) {
- *track_id = stream_out.id;
- return true;
+ if (audio_info) {
+ const cricket::MediaContentDescription* audio_content =
+ static_cast<const cricket::MediaContentDescription*>(
+ audio_info->description);
+
+ if (cricket::GetStreamBySsrc(audio_content->streams(), ssrc, &stream_out)) {
+ *track_id = stream_out.id;
+ return true;
+ }
}
const cricket::ContentInfo* video_info =
cricket::GetFirstVideoContent(session_description);
- if (!video_info) {
- return false;
- }
- const cricket::MediaContentDescription* video_content =
- static_cast<const cricket::MediaContentDescription*>(
- video_info->description);
-
- if (cricket::GetStreamBySsrc(video_content->streams(), ssrc, &stream_out)) {
- *track_id = stream_out.id;
- return true;
+ if (video_info) {
+ const cricket::MediaContentDescription* video_content =
+ static_cast<const cricket::MediaContentDescription*>(
+ video_info->description);
+
+ if (cricket::GetStreamBySsrc(video_content->streams(), ssrc, &stream_out)) {
+ *track_id = stream_out.id;
+ return true;
+ }
}
return false;
}
}
}
+uint32 ConvertIceTransportTypeToCandidateFilter(
+ PeerConnectionInterface::IceTransportsType type) {
+ switch (type) {
+ case PeerConnectionInterface::kNone:
+ return cricket::CF_NONE;
+ case PeerConnectionInterface::kRelay:
+ return cricket::CF_RELAY;
+ case PeerConnectionInterface::kNoHost:
+ return (cricket::CF_ALL & ~cricket::CF_HOST);
+ case PeerConnectionInterface::kAll:
+ return cricket::CF_ALL;
+ default: ASSERT(false);
+ }
+ return cricket::CF_NONE;
+}
+
// Help class used to remember if a a remote peer has requested ice restart by
// by sending a description with new ice ufrag and password.
class IceRestartAnswerLatch {
}
WebRtcSession::~WebRtcSession() {
- if (voice_channel_.get()) {
- SignalVoiceChannelDestroyed();
- channel_manager_->DestroyVoiceChannel(voice_channel_.release());
- }
+ // Destroy video_channel_ first since it may have a pointer to the
+ // voice_channel_.
if (video_channel_.get()) {
SignalVideoChannelDestroyed();
channel_manager_->DestroyVideoChannel(video_channel_.release());
}
+ if (voice_channel_.get()) {
+ SignalVoiceChannelDestroyed();
+ channel_manager_->DestroyVoiceChannel(voice_channel_.release());
+ }
if (data_channel_.get()) {
SignalDataChannelDestroyed();
channel_manager_->DestroyDataChannel(data_channel_.release());
MediaConstraintsInterface::kPayloadPadding,
&video_options_.use_payload_padding);
- // Find improved wifi bwe constraint.
- if (FindConstraint(
- constraints,
- MediaConstraintsInterface::kImprovedWifiBwe,
- &value,
- NULL)) {
- video_options_.use_improved_wifi_bandwidth_estimator.Set(value);
- } else {
- // Enable by default if the constraint is not set.
- video_options_.use_improved_wifi_bandwidth_estimator.Set(true);
- }
-
SetOptionFromOptionalConstraint(constraints,
MediaConstraintsInterface::kNumUnsignalledRecvStreams,
&video_options_.unsignalled_recv_stream_limit);
}
SetOptionFromOptionalConstraint(constraints,
- MediaConstraintsInterface::kOpusFec,
- &audio_options_.opus_fec);
+ MediaConstraintsInterface::kCombinedAudioVideoBwe,
+ &audio_options_.combined_audio_video_bwe);
const cricket::VideoCodec default_codec(
JsepSessionDescription::kDefaultVideoCodecId,
if (options.disable_encryption) {
webrtc_session_desc_factory_->SetSdesPolicy(cricket::SEC_DISABLED);
}
-
+ port_allocator()->set_candidate_filter(
+ ConvertIceTransportTypeToCandidateFilter(ice_transport));
return true;
}
if (!UpdateSessionState(action, cricket::CS_LOCAL, err_desc)) {
return false;
}
+
// Kick starting the ice candidates allocation.
StartCandidatesAllocation();
return UseCandidate(candidate);
}
-bool WebRtcSession::UpdateIce(PeerConnectionInterface::IceTransportsType type) {
- return false;
+bool WebRtcSession::SetIceTransports(
+ PeerConnectionInterface::IceTransportsType type) {
+ return port_allocator()->set_candidate_filter(
+ ConvertIceTransportTypeToCandidateFilter(type));
}
bool WebRtcSession::GetLocalTrackIdBySsrc(uint32 ssrc, std::string* track_id) {
void WebRtcSession::RemoveUnusedChannelsAndTransports(
const SessionDescription* desc) {
- const cricket::ContentInfo* voice_info =
- cricket::GetFirstAudioContent(desc);
- if ((!voice_info || voice_info->rejected) && voice_channel_) {
- mediastream_signaling_->OnAudioChannelClose();
- SignalVoiceChannelDestroyed();
- const std::string content_name = voice_channel_->content_name();
- channel_manager_->DestroyVoiceChannel(voice_channel_.release());
- DestroyTransportProxy(content_name);
- }
-
+ // Destroy video_channel_ first since it may have a pointer to the
+ // voice_channel_.
const cricket::ContentInfo* video_info =
cricket::GetFirstVideoContent(desc);
if ((!video_info || video_info->rejected) && video_channel_) {
DestroyTransportProxy(content_name);
}
+ const cricket::ContentInfo* voice_info =
+ cricket::GetFirstAudioContent(desc);
+ if ((!voice_info || voice_info->rejected) && voice_channel_) {
+ mediastream_signaling_->OnAudioChannelClose();
+ SignalVoiceChannelDestroyed();
+ const std::string content_name = voice_channel_->content_name();
+ channel_manager_->DestroyVoiceChannel(voice_channel_.release());
+ DestroyTransportProxy(content_name);
+ }
+
const cricket::ContentInfo* data_info =
cricket::GetFirstDataContent(desc);
if ((!data_info || data_info->rejected) && data_channel_) {