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

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

Issue 2804653003: Image Capture: make sure applyConstraints() only works for ImageCapture constraints (Closed)
Patch Set: LayoutTests Created 3 years, 8 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/imagecapture/ImageCapture.cpp ('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/MediaStreamTrack.cpp
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp
index ff12660efd8cf6ac208cf5a36d771f8c284ab989..116e98c06be0405dd13f01238bea85ae11d4d18a 100644
--- a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp
+++ b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp
@@ -305,22 +305,22 @@ ScriptPromise MediaStreamTrack::applyConstraints(
ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
ScriptPromise promise = resolver->promise();
- // |constraints| is an optional argument, which is strange.
- // TODO(mcasas): remove this provision if |constraints| is not optional:
- // https://github.com/w3c/mediacapture-main/issues/438
- if (!constraints.hasAdvanced()) {
- resolver->resolve();
- return promise;
- }
-
- if (!m_imageCapture) {
+ // TODO(mcasas): Until https://crbug.com/338503 is landed, we only support
+ // ImageCapture-related constraints.
+ if (!m_imageCapture ||
+ m_imageCapture->hasNonImageCaptureConstraints(constraints)) {
resolver->reject(DOMException::create(
- NotSupportedError, "Track type not currently supported"));
+ NotSupportedError,
+ "Only Image-Capture constraints supported (https://crbug.com/338503)"));
return promise;
}
- // TODO(mcasas): support more advanced constraints, https://crbug.com/700607.
- m_imageCapture->setMediaTrackConstraints(resolver, constraints.advanced()[0]);
+ // |constraints| empty means "remove/clear all current constraints".
+ if (!constraints.hasAdvanced())
+ m_imageCapture->clearMediaTrackConstraints(resolver);
+ else
+ m_imageCapture->setMediaTrackConstraints(resolver, constraints.advanced());
+
return promise;
}
« no previous file with comments | « third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698