| Index: third_party/WebKit/Source/platform/exported/WebMediaConstraints.cpp
|
| diff --git a/third_party/WebKit/Source/platform/exported/WebMediaConstraints.cpp b/third_party/WebKit/Source/platform/exported/WebMediaConstraints.cpp
|
| index 84125da463e946b4057791580eac659cdb27859c..079fb3c8dbb09b041d84c266a6858f8b946bfef8 100644
|
| --- a/third_party/WebKit/Source/platform/exported/WebMediaConstraints.cpp
|
| +++ b/third_party/WebKit/Source/platform/exported/WebMediaConstraints.cpp
|
| @@ -186,6 +186,11 @@ bool LongConstraint::isEmpty() const
|
| return !m_hasMin && !m_hasMax && !m_hasExact && !m_hasIdeal;
|
| }
|
|
|
| +bool LongConstraint::hasMandatory() const
|
| +{
|
| + return m_hasMin || m_hasMax || m_hasExact;
|
| +}
|
| +
|
| const double DoubleConstraint::kConstraintEpsilon = 0.00001;
|
|
|
| DoubleConstraint::DoubleConstraint(const char* name)
|
| @@ -220,6 +225,11 @@ bool DoubleConstraint::isEmpty() const
|
| return !m_hasMin && !m_hasMax && !m_hasExact && !m_hasIdeal;
|
| }
|
|
|
| +bool DoubleConstraint::hasMandatory() const
|
| +{
|
| + return m_hasMin || m_hasMax || m_hasExact;
|
| +}
|
| +
|
| StringConstraint::StringConstraint(const char* name)
|
| : BaseConstraint(name)
|
| , m_exact()
|
| @@ -245,6 +255,11 @@ bool StringConstraint::isEmpty() const
|
| return m_exact.isEmpty() && m_ideal.isEmpty();
|
| }
|
|
|
| +bool StringConstraint::hasMandatory() const
|
| +{
|
| + return !m_exact.isEmpty();
|
| +}
|
| +
|
| const WebVector<WebString>& StringConstraint::exact() const
|
| {
|
| return m_exact;
|
| @@ -277,6 +292,11 @@ bool BooleanConstraint::isEmpty() const
|
| return !m_hasIdeal && !m_hasExact;
|
| }
|
|
|
| +bool BooleanConstraint::hasMandatory() const
|
| +{
|
| + return m_hasExact;
|
| +}
|
| +
|
| WebMediaTrackConstraintSet::WebMediaTrackConstraintSet()
|
| : width("width")
|
| , height("height")
|
| @@ -332,24 +352,59 @@ WebMediaTrackConstraintSet::WebMediaTrackConstraintSet()
|
| {
|
| }
|
|
|
| +std::vector<const BaseConstraint*> WebMediaTrackConstraintSet::allConstraints() const
|
| +{
|
| + const BaseConstraint* temp[] = {
|
| + &width, &height, &aspectRatio, &frameRate, &facingMode, &volume,
|
| + &sampleRate, &sampleSize, &echoCancellation, &latency, &channelCount,
|
| + &deviceId, &groupId, &mediaStreamSource, &renderToAssociatedSink,
|
| + &hotwordEnabled, &googEchoCancellation,
|
| + &googExperimentalEchoCancellation, &googAutoGainControl,
|
| + &googExperimentalAutoGainControl, &googNoiseSuppression,
|
| + &googHighpassFilter, &googTypingNoiseDetection,
|
| + &googExperimentalNoiseSuppression, &googBeamforming,
|
| + &googArrayGeometry, &googAudioMirroring, &googDAEchoCancellation,
|
| + &googAecDump, &googNoiseReduction, &offerToReceiveAudio,
|
| + &offerToReceiveVideo, &voiceActivityDetection, &iceRestart,
|
| + &googUseRtpMux, &enableDtlsSrtp, &enableRtpDataChannels,
|
| + &enableDscp, &enableIPv6, &googEnableVideoSuspendBelowMinBitrate,
|
| + &googNumUnsignalledRecvStreams, &googCombinedAudioVideoBwe,
|
| + &googScreencastMinBitrate, &googCpuOveruseDetection,
|
| + &googCpuUnderuseThreshold, &googCpuOveruseThreshold,
|
| + &googCpuUnderuseEncodeRsdThreshold, &googCpuOveruseEncodeRsdThreshold,
|
| + &googCpuOveruseEncodeUsage, &googHighStartBitrate, &googPayloadPadding
|
| + };
|
| + const int elementCount = sizeof(temp) / sizeof(temp[0]);
|
| + return std::vector<const BaseConstraint*>(&temp[0], &temp[elementCount]);
|
| +}
|
| +
|
| bool WebMediaTrackConstraintSet::isEmpty() const
|
| {
|
| - return width.isEmpty() && height.isEmpty() && aspectRatio.isEmpty()
|
| - && frameRate.isEmpty() && facingMode.isEmpty() && volume.isEmpty()
|
| - && sampleRate.isEmpty() && sampleSize.isEmpty()
|
| - && echoCancellation.isEmpty() && latency.isEmpty()
|
| - && channelCount.isEmpty() && deviceId.isEmpty() && groupId.isEmpty()
|
| - && mediaStreamSource.isEmpty() && renderToAssociatedSink.isEmpty()
|
| - && hotwordEnabled.isEmpty() && googEchoCancellation.isEmpty()
|
| - && googExperimentalEchoCancellation.isEmpty()
|
| - && googAutoGainControl.isEmpty()
|
| - && googExperimentalAutoGainControl.isEmpty()
|
| - && googNoiseSuppression.isEmpty()
|
| - && googHighpassFilter.isEmpty()
|
| - && googTypingNoiseDetection.isEmpty()
|
| - && googExperimentalNoiseSuppression.isEmpty()
|
| - && googBeamforming.isEmpty() && googArrayGeometry.isEmpty()
|
| - && googAudioMirroring.isEmpty();
|
| + for (const auto& constraint : allConstraints()) {
|
| + if (!constraint->isEmpty())
|
| + return false;
|
| + }
|
| + return true;
|
| +}
|
| +
|
| +bool WebMediaTrackConstraintSet::hasMandatoryOutsideSet(const std::vector<std::string>& goodNames, std::string& foundName) const
|
| +{
|
| + for (const auto& constraint : allConstraints()) {
|
| + if (constraint->hasMandatory()) {
|
| + if (std::find(goodNames.begin(), goodNames.end(), constraint->name())
|
| + == goodNames.end()) {
|
| + foundName = constraint->name();
|
| + return true;
|
| + }
|
| + }
|
| + }
|
| + return false;
|
| +}
|
| +
|
| +bool WebMediaTrackConstraintSet::hasMandatory() const
|
| +{
|
| + std::string dummyString;
|
| + return hasMandatoryOutsideSet(std::vector<std::string>(), dummyString);
|
| }
|
|
|
| // WebMediaConstraints
|
|
|