| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 95 } |
| 96 | 96 |
| 97 // Returns true if |constraint| is fulfilled. |format_out| can differ from | 97 // Returns true if |constraint| is fulfilled. |format_out| can differ from |
| 98 // |format_in| if the format is changed by the constraint. Ie - the frame rate | 98 // |format_in| if the format is changed by the constraint. Ie - the frame rate |
| 99 // can be changed by setting maxFrameRate. | 99 // can be changed by setting maxFrameRate. |
| 100 bool NewFormatWithConstraints( | 100 bool NewFormatWithConstraints( |
| 101 const MediaConstraintsInterface::Constraint& constraint, | 101 const MediaConstraintsInterface::Constraint& constraint, |
| 102 const cricket::VideoFormat& format_in, | 102 const cricket::VideoFormat& format_in, |
| 103 bool mandatory, | 103 bool mandatory, |
| 104 cricket::VideoFormat* format_out) { | 104 cricket::VideoFormat* format_out) { |
| 105 RTC_DCHECK(format_out != NULL); | 105 RTC_DCHECK(format_out != nullptr); |
| 106 *format_out = format_in; | 106 *format_out = format_in; |
| 107 | 107 |
| 108 if (constraint.key == MediaConstraintsInterface::kMinWidth) { | 108 if (constraint.key == MediaConstraintsInterface::kMinWidth) { |
| 109 int value = rtc::FromString<int>(constraint.value); | 109 int value = rtc::FromString<int>(constraint.value); |
| 110 return (value <= format_in.width); | 110 return (value <= format_in.width); |
| 111 } else if (constraint.key == MediaConstraintsInterface::kMaxWidth) { | 111 } else if (constraint.key == MediaConstraintsInterface::kMaxWidth) { |
| 112 int value = rtc::FromString<int>(constraint.value); | 112 int value = rtc::FromString<int>(constraint.value); |
| 113 return (value >= format_in.width); | 113 return (value >= format_in.width); |
| 114 } else if (constraint.key == MediaConstraintsInterface::kMinHeight) { | 114 } else if (constraint.key == MediaConstraintsInterface::kMinHeight) { |
| 115 int value = rtc::FromString<int>(constraint.value); | 115 int value = rtc::FromString<int>(constraint.value); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 | 254 |
| 255 } // anonymous namespace | 255 } // anonymous namespace |
| 256 | 256 |
| 257 namespace webrtc { | 257 namespace webrtc { |
| 258 | 258 |
| 259 rtc::scoped_refptr<VideoTrackSourceInterface> VideoCapturerTrackSource::Create( | 259 rtc::scoped_refptr<VideoTrackSourceInterface> VideoCapturerTrackSource::Create( |
| 260 rtc::Thread* worker_thread, | 260 rtc::Thread* worker_thread, |
| 261 cricket::VideoCapturer* capturer, | 261 cricket::VideoCapturer* capturer, |
| 262 const webrtc::MediaConstraintsInterface* constraints, | 262 const webrtc::MediaConstraintsInterface* constraints, |
| 263 bool remote) { | 263 bool remote) { |
| 264 RTC_DCHECK(worker_thread != NULL); | 264 RTC_DCHECK(worker_thread != nullptr); |
| 265 RTC_DCHECK(capturer != NULL); | 265 RTC_DCHECK(capturer != nullptr); |
| 266 rtc::scoped_refptr<VideoCapturerTrackSource> source( | 266 rtc::scoped_refptr<VideoCapturerTrackSource> source( |
| 267 new rtc::RefCountedObject<VideoCapturerTrackSource>(worker_thread, | 267 new rtc::RefCountedObject<VideoCapturerTrackSource>(worker_thread, |
| 268 capturer, remote)); | 268 capturer, remote)); |
| 269 source->Initialize(constraints); | 269 source->Initialize(constraints); |
| 270 return source; | 270 return source; |
| 271 } | 271 } |
| 272 | 272 |
| 273 rtc::scoped_refptr<VideoTrackSourceInterface> VideoCapturerTrackSource::Create( | 273 rtc::scoped_refptr<VideoTrackSourceInterface> VideoCapturerTrackSource::Create( |
| 274 rtc::Thread* worker_thread, | 274 rtc::Thread* worker_thread, |
| 275 cricket::VideoCapturer* capturer, | 275 cricket::VideoCapturer* capturer, |
| 276 bool remote) { | 276 bool remote) { |
| 277 RTC_DCHECK(worker_thread != NULL); | 277 RTC_DCHECK(worker_thread != nullptr); |
| 278 RTC_DCHECK(capturer != NULL); | 278 RTC_DCHECK(capturer != nullptr); |
| 279 rtc::scoped_refptr<VideoCapturerTrackSource> source( | 279 rtc::scoped_refptr<VideoCapturerTrackSource> source( |
| 280 new rtc::RefCountedObject<VideoCapturerTrackSource>(worker_thread, | 280 new rtc::RefCountedObject<VideoCapturerTrackSource>(worker_thread, |
| 281 capturer, remote)); | 281 capturer, remote)); |
| 282 source->Initialize(nullptr); | 282 source->Initialize(nullptr); |
| 283 return source; | 283 return source; |
| 284 } | 284 } |
| 285 | 285 |
| 286 VideoCapturerTrackSource::VideoCapturerTrackSource( | 286 VideoCapturerTrackSource::VideoCapturerTrackSource( |
| 287 rtc::Thread* worker_thread, | 287 rtc::Thread* worker_thread, |
| 288 cricket::VideoCapturer* capturer, | 288 cricket::VideoCapturer* capturer, |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 capture_state)); | 388 capture_state)); |
| 389 return; | 389 return; |
| 390 } | 390 } |
| 391 | 391 |
| 392 if (capturer == video_capturer_.get()) { | 392 if (capturer == video_capturer_.get()) { |
| 393 SetState(GetReadyState(capture_state)); | 393 SetState(GetReadyState(capture_state)); |
| 394 } | 394 } |
| 395 } | 395 } |
| 396 | 396 |
| 397 } // namespace webrtc | 397 } // namespace webrtc |
| OLD | NEW |