summaryrefslogtreecommitdiff
path: root/app/webrtc/webrtcsession.cc
diff options
context:
space:
mode:
Diffstat (limited to 'app/webrtc/webrtcsession.cc')
-rw-r--r--app/webrtc/webrtcsession.cc45
1 files changed, 22 insertions, 23 deletions
diff --git a/app/webrtc/webrtcsession.cc b/app/webrtc/webrtcsession.cc
index 17177bd..1b1c287 100644
--- a/app/webrtc/webrtcsession.cc
+++ b/app/webrtc/webrtcsession.cc
@@ -371,14 +371,15 @@ static std::string MakeTdErrorString(const std::string& desc) {
// Set |option| to the highest-priority value of |key| in the optional
// constraints if the key is found and has a valid value.
+template<typename T>
static void SetOptionFromOptionalConstraint(
const MediaConstraintsInterface* constraints,
- const std::string& key, cricket::Settable<int>* option) {
+ const std::string& key, cricket::Settable<T>* option) {
if (!constraints) {
return;
}
std::string string_value;
- int value;
+ T value;
if (constraints->GetOptional().FindFirst(key, &string_value)) {
if (talk_base::FromString(string_value, &value)) {
option->Set(value);
@@ -565,26 +566,22 @@ bool WebRtcSession::Initialize(
MediaConstraintsInterface::kCpuOveruseThreshold,
&video_options_.cpu_overuse_threshold);
SetOptionFromOptionalConstraint(constraints,
+ MediaConstraintsInterface::kCpuOveruseDetection,
+ &video_options_.cpu_overuse_detection);
+ SetOptionFromOptionalConstraint(constraints,
+ MediaConstraintsInterface::kCpuOveruseEncodeUsage,
+ &video_options_.cpu_overuse_encode_usage);
+ SetOptionFromOptionalConstraint(constraints,
MediaConstraintsInterface::kCpuUnderuseEncodeRsdThreshold,
&video_options_.cpu_underuse_encode_rsd_threshold);
SetOptionFromOptionalConstraint(constraints,
MediaConstraintsInterface::kCpuOveruseEncodeRsdThreshold,
&video_options_.cpu_overuse_encode_rsd_threshold);
- if (FindConstraint(
- constraints,
- MediaConstraintsInterface::kCpuOveruseDetection,
- &value,
- NULL)) {
- video_options_.cpu_overuse_detection.Set(value);
- }
- if (FindConstraint(
- constraints,
- MediaConstraintsInterface::kCpuOveruseEncodeUsage,
- &value,
- NULL)) {
- video_options_.cpu_overuse_encode_usage.Set(value);
- }
+ // Find payload padding constraint.
+ SetOptionFromOptionalConstraint(constraints,
+ MediaConstraintsInterface::kPayloadPadding,
+ &video_options_.use_payload_padding);
// Find improved wifi bwe constraint.
if (FindConstraint(
@@ -598,13 +595,9 @@ bool WebRtcSession::Initialize(
video_options_.use_improved_wifi_bandwidth_estimator.Set(true);
}
- if (FindConstraint(
- constraints,
- MediaConstraintsInterface::kHighStartBitrate,
- &value,
- NULL)) {
- video_options_.video_start_bitrate.Set(cricket::kHighStartBitrate);
- }
+ SetOptionFromOptionalConstraint(constraints,
+ MediaConstraintsInterface::kHighStartBitrate,
+ &video_options_.video_start_bitrate);
if (FindConstraint(
constraints,
@@ -622,6 +615,10 @@ bool WebRtcSession::Initialize(
cricket::VideoOptions::HIGH);
}
+ SetOptionFromOptionalConstraint(constraints,
+ MediaConstraintsInterface::kOpusFec,
+ &audio_options_.opus_fec);
+
const cricket::VideoCodec default_codec(
JsepSessionDescription::kDefaultVideoCodecId,
JsepSessionDescription::kDefaultVideoCodecName,
@@ -1151,6 +1148,8 @@ void WebRtcSession::AddSctpDataStream(uint32 sid) {
}
void WebRtcSession::RemoveSctpDataStream(uint32 sid) {
+ mediastream_signaling_->RemoveSctpDataChannel(static_cast<int>(sid));
+
if (!data_channel_.get()) {
LOG(LS_ERROR) << "RemoveDataChannelStreams called when data_channel_ is "
<< "NULL.";