Add support for enabling simulcast in "Plan B" using MediaConstraints.

BUG=webrtc:9655

Change-Id: Ieb5fe5d97b6d4381608a51593bca5423979d1b9f
Reviewed-on: https://webrtc-review.googlesource.com/95481
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24424}
This commit is contained in:
Jonas Oreland
2018-08-24 10:58:37 +02:00
committed by Commit Bot
parent d65e143801
commit fc1acd2364
5 changed files with 76 additions and 4 deletions

View File

@ -146,6 +146,9 @@ const char MediaConstraintsInterface::kCpuOveruseDetection[] =
"googCpuOveruseDetection";
const char MediaConstraintsInterface::kPayloadPadding[] = "googPayloadPadding";
const char MediaConstraintsInterface::kNumSimulcastLayers[] =
"googNumSimulcastLayers";
// Set |value| to the value associated with the first appearance of |key|, or
// return false if |key| is not found.
bool MediaConstraintsInterface::Constraints::FindFirst(
@ -301,6 +304,13 @@ bool CopyConstraintsIntoOfferAnswerOptions(
offer_answer_options->ice_restart = value;
}
int layers;
if (FindConstraint(constraints,
MediaConstraintsInterface::kNumSimulcastLayers,
&layers, &mandatory_constraints_satisfied)) {
offer_answer_options->num_simulcast_layers = layers;
}
return mandatory_constraints_satisfied == constraints->GetMandatory().size();
}

View File

@ -119,6 +119,11 @@ class MediaConstraintsInterface {
// stripped by Chrome before passed down to Libjingle.
static const char kInternalConstraintPrefix[];
// Specifies number of simulcast layers for all video tracks
// with a Plan B offer/answer
// (see RTCOfferAnswerOptions::num_simulcast_layers).
static const char kNumSimulcastLayers[];
virtual ~MediaConstraintsInterface() = default;
virtual const Constraints& GetMandatory() const = 0;

View File

@ -596,6 +596,9 @@ class PeerConnectionInterface : public rtc::RefCountInterface {
// confused with RTCP mux (multiplexing RTP and RTCP together).
bool use_rtp_mux = true;
// This will apply to all video tracks with a Plan B SDP offer/answer.
int num_simulcast_layers = 1;
RTCOfferAnswerOptions() = default;
RTCOfferAnswerOptions(int offer_to_receive_video,