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 // Add the image capture constraints as another entry to the advanced(). | |
Reilly Grant (use Gerrit)
2017/03/18 01:17:13
*to advanced
mcasas
2017/03/18 01:26:00
Done.
| |
234 HeapVector<MediaTrackConstraintSet> vector; | |
235 if (constraints.hasAdvanced()) | |
236 vector = constraints.advanced(); | |
237 auto imageCaptureConstraints = m_imageCapture->getMediaTrackConstraints(); | |
238 // TODO(mcasas): add |torch|, https://crbug.com/700607. | |
239 if (imageCaptureConstraints.hasWhiteBalanceMode() || | |
240 imageCaptureConstraints.hasExposureMode() || | |
241 imageCaptureConstraints.hasFocusMode() || | |
242 imageCaptureConstraints.hasExposureCompensation() || | |
243 imageCaptureConstraints.hasColorTemperature() || | |
244 imageCaptureConstraints.hasIso() || | |
245 imageCaptureConstraints.hasBrightness() || | |
246 imageCaptureConstraints.hasContrast() || | |
247 imageCaptureConstraints.hasSaturation() || | |
248 imageCaptureConstraints.hasSharpness() || | |
249 imageCaptureConstraints.hasZoom()) { | |
250 } | |
251 constraints.setAdvanced(vector); | |
Reilly Grant (use Gerrit)
2017/03/18 01:17:13
This line should perhaps be in the body of the if
mcasas
2017/03/18 01:26:00
Ouch yeah - sorry, I must have lost in a rebase.
P
| |
252 } | |
253 | |
232 void MediaStreamTrack::getSettings(MediaTrackSettings& settings) { | 254 void MediaStreamTrack::getSettings(MediaTrackSettings& settings) { |
233 WebMediaStreamTrack::Settings platformSettings; | 255 WebMediaStreamTrack::Settings platformSettings; |
234 m_component->getSettings(platformSettings); | 256 m_component->getSettings(platformSettings); |
235 if (platformSettings.hasFrameRate()) { | 257 if (platformSettings.hasFrameRate()) |
236 settings.setFrameRate(platformSettings.frameRate); | 258 settings.setFrameRate(platformSettings.frameRate); |
237 } | 259 if (platformSettings.hasWidth()) |
238 if (platformSettings.hasWidth()) { | |
239 settings.setWidth(platformSettings.width); | 260 settings.setWidth(platformSettings.width); |
240 } | 261 if (platformSettings.hasHeight()) |
241 if (platformSettings.hasHeight()) { | |
242 settings.setHeight(platformSettings.height); | 262 settings.setHeight(platformSettings.height); |
243 } | |
244 if (RuntimeEnabledFeatures::mediaCaptureDepthEnabled() && | 263 if (RuntimeEnabledFeatures::mediaCaptureDepthEnabled() && |
245 m_component->source()->type() == MediaStreamSource::TypeVideo) { | 264 m_component->source()->type() == MediaStreamSource::TypeVideo) { |
246 if (platformSettings.hasVideoKind()) | 265 if (platformSettings.hasVideoKind()) |
247 settings.setVideoKind(platformSettings.videoKind); | 266 settings.setVideoKind(platformSettings.videoKind); |
248 if (platformSettings.hasDepthNear()) | 267 if (platformSettings.hasDepthNear()) |
249 settings.setDepthNear(platformSettings.depthNear); | 268 settings.setDepthNear(platformSettings.depthNear); |
250 if (platformSettings.hasDepthFar()) | 269 if (platformSettings.hasDepthFar()) |
251 settings.setDepthFar(platformSettings.depthFar); | 270 settings.setDepthFar(platformSettings.depthFar); |
252 if (platformSettings.hasFocalLengthX()) | 271 if (platformSettings.hasFocalLengthX()) |
253 settings.setFocalLengthX(platformSettings.focalLengthX); | 272 settings.setFocalLengthX(platformSettings.focalLengthX); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
384 | 403 |
385 DEFINE_TRACE(MediaStreamTrack) { | 404 DEFINE_TRACE(MediaStreamTrack) { |
386 visitor->trace(m_registeredMediaStreams); | 405 visitor->trace(m_registeredMediaStreams); |
387 visitor->trace(m_component); | 406 visitor->trace(m_component); |
388 visitor->trace(m_imageCapture); | 407 visitor->trace(m_imageCapture); |
389 EventTargetWithInlineData::trace(visitor); | 408 EventTargetWithInlineData::trace(visitor); |
390 ContextLifecycleObserver::trace(visitor); | 409 ContextLifecycleObserver::trace(visitor); |
391 } | 410 } |
392 | 411 |
393 } // namespace blink | 412 } // namespace blink |
OLD | NEW |