Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/media/media_stream_video_track.h" | 5 #include "content/renderer/media/media_stream_video_track.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 287 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
| 288 if (source_) { | 288 if (source_) { |
| 289 source_->RemoveTrack(this); | 289 source_->RemoveTrack(this); |
| 290 source_ = NULL; | 290 source_ = NULL; |
| 291 } | 291 } |
| 292 OnReadyStateChanged(blink::WebMediaStreamSource::ReadyStateEnded); | 292 OnReadyStateChanged(blink::WebMediaStreamSource::ReadyStateEnded); |
| 293 } | 293 } |
| 294 | 294 |
| 295 void MediaStreamVideoTrack::getSettings( | 295 void MediaStreamVideoTrack::getSettings( |
| 296 blink::WebMediaStreamTrack::Settings& settings) { | 296 blink::WebMediaStreamTrack::Settings& settings) { |
| 297 if (source_) { | |
| 298 const media::VideoCaptureFormat* format = source_->GetCurrentFormat(); | |
| 299 if (format) { | |
| 300 settings.frameRate = format->frame_rate; | |
| 301 settings.width = format->frame_size.width(); | |
| 302 settings.height = format->frame_size.height(); | |
| 303 } | |
| 304 } | |
| 305 // TODO(hta): Extract the real value. | 297 // TODO(hta): Extract the real value. |
| 306 settings.deviceId = blink::WebString("video device ID"); | 298 settings.deviceId = blink::WebString("video device ID"); |
| 299 if (!source_) | |
| 300 return; | |
|
kinuko
2017/01/10 14:43:24
why don't we have this before line 298?
aleksandar.stojiljkovic
2017/01/11 08:58:46
Good point.
That change would be a functionality c
aleksandar.stojiljkovic
2017/01/11 09:32:18
Please ignore a note about non-const reference. As
| |
| 301 | |
| 302 const media::VideoCaptureFormat* format = source_->GetCurrentFormat(); | |
| 303 if (format) { | |
| 304 settings.frameRate = format->frame_rate; | |
| 305 settings.width = format->frame_size.width(); | |
| 306 settings.height = format->frame_size.height(); | |
| 307 } | |
| 308 const base::Optional<CameraCalibration> calibration = | |
| 309 source_->device_info().device.camera_calibration; | |
| 310 if (calibration) { | |
| 311 settings.depthNear = calibration->depth_near; | |
| 312 settings.depthFar = calibration->depth_far; | |
| 313 settings.focalLengthX = calibration->focal_length_x; | |
| 314 settings.focalLengthY = calibration->focal_length_y; | |
| 315 } | |
| 307 } | 316 } |
| 308 | 317 |
| 309 void MediaStreamVideoTrack::OnReadyStateChanged( | 318 void MediaStreamVideoTrack::OnReadyStateChanged( |
| 310 blink::WebMediaStreamSource::ReadyState state) { | 319 blink::WebMediaStreamSource::ReadyState state) { |
| 311 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 320 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
| 312 for (auto* sink : sinks_) | 321 for (auto* sink : sinks_) |
| 313 sink->OnReadyStateChanged(state); | 322 sink->OnReadyStateChanged(state); |
| 314 } | 323 } |
| 315 | 324 |
| 316 } // namespace content | 325 } // namespace content |
| OLD | NEW |