Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Ericsson AB. All rights reserved. | 3 * Copyright (C) 2011 Ericsson AB. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 MediaStreamTrack* MediaStreamTrack::clone(ScriptState* scriptState) { | 209 MediaStreamTrack* MediaStreamTrack::clone(ScriptState* scriptState) { |
| 210 // TODO(pbos): Make sure m_readyState and m_stopped carries over on cloned | 210 // TODO(pbos): Make sure m_readyState and m_stopped carries over on cloned |
| 211 // tracks. | 211 // tracks. |
| 212 MediaStreamComponent* clonedComponent = component()->clone(); | 212 MediaStreamComponent* clonedComponent = component()->clone(); |
| 213 MediaStreamTrack* clonedTrack = MediaStreamTrack::create( | 213 MediaStreamTrack* clonedTrack = MediaStreamTrack::create( |
| 214 scriptState->getExecutionContext(), clonedComponent); | 214 scriptState->getExecutionContext(), clonedComponent); |
| 215 MediaStreamCenter::instance().didCreateMediaStreamTrack(clonedComponent); | 215 MediaStreamCenter::instance().didCreateMediaStreamTrack(clonedComponent); |
| 216 return clonedTrack; | 216 return clonedTrack; |
| 217 } | 217 } |
| 218 | 218 |
| 219 void MediaStreamTrack::getConstraints(MediaTrackConstraints& constraints) { | |
| 220 MediaConstraintsImpl::convertConstraints(m_constraints, constraints); | |
| 221 } | |
| 222 | |
| 223 void MediaStreamTrack::setConstraints(const WebMediaConstraints& constraints) { | 219 void MediaStreamTrack::setConstraints(const WebMediaConstraints& constraints) { |
| 224 m_constraints = constraints; | 220 m_constraints = constraints; |
| 225 } | 221 } |
| 226 | 222 |
| 227 void MediaStreamTrack::getCapabilities(MediaTrackCapabilities& capabilities) { | 223 void MediaStreamTrack::getCapabilities(MediaTrackCapabilities& capabilities) { |
| 228 if (m_imageCapture) | 224 if (m_imageCapture) |
| 229 capabilities = m_imageCapture->getMediaTrackCapabilities(); | 225 capabilities = m_imageCapture->getMediaTrackCapabilities(); |
| 230 } | 226 } |
| 231 | 227 |
| 228 void MediaStreamTrack::getConstraints(MediaTrackConstraints& constraints) { | |
| 229 MediaConstraintsImpl::convertConstraints(m_constraints, constraints); | |
| 230 | |
| 231 if (!m_imageCapture) | |
| 232 return; | |
| 233 HeapVector<MediaTrackConstraintSet> vector; | |
| 234 if (constraints.hasAdvanced()) | |
|
Guido Urdaneta
2017/03/19 13:53:12
Shouldn't you support basic constraints as well?
I
mcasas
2017/03/19 20:37:40
IIUC all ImageCapture constraints go under the
ad
Guido Urdaneta
2017/03/20 09:17:35
I see that the code in the previous CL just passes
mcasas
2017/03/20 16:45:56
Correct, but note that the use of advanced[0] in a
| |
| 235 vector = constraints.advanced(); | |
| 236 auto imageCaptureConstraints = m_imageCapture->getMediaTrackConstraints(); | |
| 237 // TODO(mcasas): add |torch|, https://crbug.com/700607. | |
| 238 if (imageCaptureConstraints.hasWhiteBalanceMode() || | |
| 239 imageCaptureConstraints.hasExposureMode() || | |
| 240 imageCaptureConstraints.hasFocusMode() || | |
| 241 imageCaptureConstraints.hasExposureCompensation() || | |
| 242 imageCaptureConstraints.hasColorTemperature() || | |
| 243 imageCaptureConstraints.hasIso() || | |
| 244 imageCaptureConstraints.hasBrightness() || | |
| 245 imageCaptureConstraints.hasContrast() || | |
| 246 imageCaptureConstraints.hasSaturation() || | |
| 247 imageCaptureConstraints.hasSharpness() || | |
| 248 imageCaptureConstraints.hasZoom()) { | |
| 249 // Add image capture constraints, if any, as another entry to advanced(). | |
| 250 vector.emplace_back(imageCaptureConstraints); | |
| 251 constraints.setAdvanced(vector); | |
| 252 } | |
| 253 } | |
| 254 | |
| 232 void MediaStreamTrack::getSettings(MediaTrackSettings& settings) { | 255 void MediaStreamTrack::getSettings(MediaTrackSettings& settings) { |
| 233 WebMediaStreamTrack::Settings platformSettings; | 256 WebMediaStreamTrack::Settings platformSettings; |
| 234 m_component->getSettings(platformSettings); | 257 m_component->getSettings(platformSettings); |
| 235 if (platformSettings.hasFrameRate()) { | 258 if (platformSettings.hasFrameRate()) |
| 236 settings.setFrameRate(platformSettings.frameRate); | 259 settings.setFrameRate(platformSettings.frameRate); |
| 237 } | 260 if (platformSettings.hasWidth()) |
| 238 if (platformSettings.hasWidth()) { | |
| 239 settings.setWidth(platformSettings.width); | 261 settings.setWidth(platformSettings.width); |
| 240 } | 262 if (platformSettings.hasHeight()) |
| 241 if (platformSettings.hasHeight()) { | |
| 242 settings.setHeight(platformSettings.height); | 263 settings.setHeight(platformSettings.height); |
| 243 } | |
| 244 if (RuntimeEnabledFeatures::mediaCaptureDepthEnabled() && | 264 if (RuntimeEnabledFeatures::mediaCaptureDepthEnabled() && |
| 245 m_component->source()->type() == MediaStreamSource::TypeVideo) { | 265 m_component->source()->type() == MediaStreamSource::TypeVideo) { |
| 246 if (platformSettings.hasVideoKind()) | 266 if (platformSettings.hasVideoKind()) |
| 247 settings.setVideoKind(platformSettings.videoKind); | 267 settings.setVideoKind(platformSettings.videoKind); |
| 248 if (platformSettings.hasDepthNear()) | 268 if (platformSettings.hasDepthNear()) |
| 249 settings.setDepthNear(platformSettings.depthNear); | 269 settings.setDepthNear(platformSettings.depthNear); |
| 250 if (platformSettings.hasDepthFar()) | 270 if (platformSettings.hasDepthFar()) |
| 251 settings.setDepthFar(platformSettings.depthFar); | 271 settings.setDepthFar(platformSettings.depthFar); |
| 252 if (platformSettings.hasFocalLengthX()) | 272 if (platformSettings.hasFocalLengthX()) |
| 253 settings.setFocalLengthX(platformSettings.focalLengthX); | 273 settings.setFocalLengthX(platformSettings.focalLengthX); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 384 | 404 |
| 385 DEFINE_TRACE(MediaStreamTrack) { | 405 DEFINE_TRACE(MediaStreamTrack) { |
| 386 visitor->trace(m_registeredMediaStreams); | 406 visitor->trace(m_registeredMediaStreams); |
| 387 visitor->trace(m_component); | 407 visitor->trace(m_component); |
| 388 visitor->trace(m_imageCapture); | 408 visitor->trace(m_imageCapture); |
| 389 EventTargetWithInlineData::trace(visitor); | 409 EventTargetWithInlineData::trace(visitor); |
| 390 ContextLifecycleObserver::trace(visitor); | 410 ContextLifecycleObserver::trace(visitor); |
| 391 } | 411 } |
| 392 | 412 |
| 393 } // namespace blink | 413 } // namespace blink |
| OLD | NEW |