Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(774)

Unified Diff: third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp

Issue 1636403002: Allow and ignore the googLeakyBucket constraint. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed from WTF_LOG to console message Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp b/third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp
index 74b5f0a9dd26c2a6dbe3a03cde467b16c20ea5bb..7ae17aa8735ae522c6513518b49e8f89fb7a3ba7 100644
--- a/third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp
+++ b/third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp
@@ -34,7 +34,9 @@
#include "bindings/core/v8/Dictionary.h"
#include "bindings/core/v8/ExceptionState.h"
#include "core/dom/ExceptionCode.h"
+#include "core/dom/ExecutionContext.h"
#include "core/frame/UseCounter.h"
+#include "core/inspector/ConsoleMessage.h"
#include "modules/mediastream/MediaTrackConstraintSet.h"
#include "platform/Logging.h"
#include "platform/RuntimeEnabledFeatures.h"
@@ -123,6 +125,11 @@ const char kCpuOveruseEncodeUsage[] = "googCpuOveruseEncodeUsage";
const char kHighStartBitrate[] = "googHighStartBitrate";
const char kPayloadPadding[] = "googPayloadPadding";
// End of names from libjingle
+// Names that have been used in the past, but should now be ignored.
+// Kept around for backwards compatibility.
+// https://crbug.com/579729
+const char kGoogLeakyBucket[] = "googLeakyBucket";
+const char kEnableAutoThrottling[] = "enableAutoThrottling";
miu 2016/01/28 21:11:46 Please remove this one (enableAutoThrottling). Th
hta - Chromium 2016/01/29 06:59:51 I wondered where it came from... took it off your
// Names used for testing.
const char kTestConstraint1[] = "valid_and_supported_1";
@@ -247,7 +254,7 @@ static bool toBoolean(const WebString& asWebString)
// https://crbug.com/576582
}
-static void parseOldStyleNames(const WebVector<WebMediaConstraint>& oldNames, WebMediaTrackConstraintSet& result, MediaErrorState& errorState)
+static void parseOldStyleNames(ExecutionContext* context, const WebVector<WebMediaConstraint>& oldNames, WebMediaTrackConstraintSet& result, MediaErrorState& errorState)
{
for (const WebMediaConstraint& constraint : oldNames) {
if (constraint.m_name.equals(kMinAspectRatio)) {
@@ -353,32 +360,40 @@ static void parseOldStyleNames(const WebVector<WebMediaConstraint>& oldNames, We
result.googHighStartBitrate.setExact(atoi(constraint.m_value.utf8().c_str()));
} else if (constraint.m_name.equals(kPayloadPadding)) {
result.googPayloadPadding.setExact(toBoolean(constraint.m_value));
+ } else if (constraint.m_name.equals(kGoogLeakyBucket)
+ || constraint.m_name.equals(kEnableAutoThrottling)) {
+ context->addConsoleMessage(ConsoleMessage::create(DeprecationMessageSource, WarningMessageLevel,
+ "Obsolete constraint named " + String(constraint.m_name)
+ + " is ignored. Please stop using it."));
} else if (constraint.m_name.equals(kTestConstraint1)
|| constraint.m_name.equals(kTestConstraint2)) {
// These constraints are only for testing parsing.
// Values 0 and 1 are legal, all others are a ConstraintError.
- if (!constraint.m_value.equals("0") && !constraint.m_value.equals("1"))
+ if (!constraint.m_value.equals("0") && !constraint.m_value.equals("1")) {
errorState.throwConstraintError("Illegal value for constraint", constraint.m_name);
+ }
} else {
// TODO(hta): UMA stats for unknown constraints passed.
// https://crbug.com/576613
+ context->addConsoleMessage(ConsoleMessage::create(DeprecationMessageSource, ErrorMessageLevel,
+ "Unknown constraint named " + String(constraint.m_name) + " rejected"));
WTF_LOG(Media, "Unknown constraint name detected");
errorState.throwConstraintError("Unknown name of constraint detected", constraint.m_name);
}
}
}
-static WebMediaConstraints createFromNamedConstraints(WebVector<WebMediaConstraint>& mandatory, const WebVector<WebMediaConstraint>& optional, MediaErrorState& errorState)
+static WebMediaConstraints createFromNamedConstraints(ExecutionContext* context, WebVector<WebMediaConstraint>& mandatory, const WebVector<WebMediaConstraint>& optional, MediaErrorState& errorState)
{
WebMediaTrackConstraintSet basic;
WebMediaTrackConstraintSet advanced;
WebMediaConstraints constraints;
- parseOldStyleNames(mandatory, basic, errorState);
+ parseOldStyleNames(context, mandatory, basic, errorState);
if (errorState.hadException())
return constraints;
// We ignore errors in optional constraints.
MediaErrorState ignoredErrorState;
- parseOldStyleNames(optional, advanced, ignoredErrorState);
+ parseOldStyleNames(context, optional, advanced, ignoredErrorState);
WebVector<WebMediaTrackConstraintSet> advancedVector(&advanced, 1);
// Use the 4-argument initializer until Chrome has been converted.
constraints.initialize(optional, mandatory, basic, advancedVector);
@@ -386,7 +401,7 @@ static WebMediaConstraints createFromNamedConstraints(WebVector<WebMediaConstrai
}
// Deprecated.
-WebMediaConstraints create(const ExecutionContext* context, const Dictionary& constraintsDictionary, MediaErrorState& errorState)
+WebMediaConstraints create(ExecutionContext* context, const Dictionary& constraintsDictionary, MediaErrorState& errorState)
{
WebVector<WebMediaConstraint> optional;
WebVector<WebMediaConstraint> mandatory;
@@ -395,7 +410,7 @@ WebMediaConstraints create(const ExecutionContext* context, const Dictionary& co
return WebMediaConstraints();
}
UseCounter::count(context, UseCounter::MediaStreamConstraintsFromDictionary);
- return createFromNamedConstraints(mandatory, optional, errorState);
+ return createFromNamedConstraints(context, mandatory, optional, errorState);
}
void copyLongConstraint(const ConstrainLongRange& blinkForm, LongConstraint& webForm)
@@ -493,7 +508,7 @@ void copyConstraints(const MediaTrackConstraintSet& constraintsIn, WebMediaTrack
}
}
-WebMediaConstraints create(const ExecutionContext* context, const MediaTrackConstraintSet& constraintsIn, MediaErrorState& errorState)
+WebMediaConstraints create(ExecutionContext* context, const MediaTrackConstraintSet& constraintsIn, MediaErrorState& errorState)
{
WebMediaConstraints constraints;
WebMediaTrackConstraintSet constraintBuffer;
@@ -513,7 +528,7 @@ WebMediaConstraints create(const ExecutionContext* context, const MediaTrackCons
return WebMediaConstraints();
}
UseCounter::count(context, UseCounter::MediaStreamConstraintsNameValue);
- return createFromNamedConstraints(mandatory, optional, errorState);
+ return createFromNamedConstraints(context, mandatory, optional, errorState);
}
UseCounter::count(context, UseCounter::MediaStreamConstraintsConformant);
constraints.initialize(constraintBuffer, advancedBuffer);
« no previous file with comments | « third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698