| 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" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
| 14 #include "content/renderer/media/media_stream_constraints_util_video_source.h" |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 void ResetCallback(std::unique_ptr<VideoCaptureDeliverFrameCB> callback) { | 19 void ResetCallback(std::unique_ptr<VideoCaptureDeliverFrameCB> callback) { |
| 19 // |callback| will be deleted when this exits. | 20 // |callback| will be deleted when this exits. |
| 20 } | 21 } |
| 21 | 22 |
| 22 // Empty method used for keeping a reference to the original media::VideoFrame. | 23 // Empty method used for keeping a reference to the original media::VideoFrame. |
| 23 // The reference to |frame| is kept in the closure that calls this method. | 24 // The reference to |frame| is kept in the closure that calls this method. |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 // TODO(hta): Extract the real value. | 305 // TODO(hta): Extract the real value. |
| 305 settings.deviceId = blink::WebString("video device ID"); | 306 settings.deviceId = blink::WebString("video device ID"); |
| 306 if (!source_) | 307 if (!source_) |
| 307 return; | 308 return; |
| 308 | 309 |
| 309 const media::VideoCaptureFormat* format = source_->GetCurrentFormat(); | 310 const media::VideoCaptureFormat* format = source_->GetCurrentFormat(); |
| 310 if (format) { | 311 if (format) { |
| 311 settings.frameRate = format->frame_rate; | 312 settings.frameRate = format->frame_rate; |
| 312 settings.width = format->frame_size.width(); | 313 settings.width = format->frame_size.width(); |
| 313 settings.height = format->frame_size.height(); | 314 settings.height = format->frame_size.height(); |
| 315 settings.videoKind = GetVideoKindForFormat(*format); |
| 314 } | 316 } |
| 315 switch (source_->device_info().device.video_facing) { | 317 switch (source_->device_info().device.video_facing) { |
| 316 case media::MEDIA_VIDEO_FACING_NONE: | 318 case media::MEDIA_VIDEO_FACING_NONE: |
| 317 settings.facingMode = blink::WebMediaStreamTrack::FacingMode::None; | 319 settings.facingMode = blink::WebMediaStreamTrack::FacingMode::None; |
| 318 break; | 320 break; |
| 319 case media::MEDIA_VIDEO_FACING_USER: | 321 case media::MEDIA_VIDEO_FACING_USER: |
| 320 settings.facingMode = blink::WebMediaStreamTrack::FacingMode::User; | 322 settings.facingMode = blink::WebMediaStreamTrack::FacingMode::User; |
| 321 break; | 323 break; |
| 322 case media::MEDIA_VIDEO_FACING_ENVIRONMENT: | 324 case media::MEDIA_VIDEO_FACING_ENVIRONMENT: |
| 323 settings.facingMode = blink::WebMediaStreamTrack::FacingMode::Environment; | 325 settings.facingMode = blink::WebMediaStreamTrack::FacingMode::Environment; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 337 } | 339 } |
| 338 | 340 |
| 339 void MediaStreamVideoTrack::OnReadyStateChanged( | 341 void MediaStreamVideoTrack::OnReadyStateChanged( |
| 340 blink::WebMediaStreamSource::ReadyState state) { | 342 blink::WebMediaStreamSource::ReadyState state) { |
| 341 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 343 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
| 342 for (auto* sink : sinks_) | 344 for (auto* sink : sinks_) |
| 343 sink->OnReadyStateChanged(state); | 345 sink->OnReadyStateChanged(state); |
| 344 } | 346 } |
| 345 | 347 |
| 346 } // namespace content | 348 } // namespace content |
| OLD | NEW |