| 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 295 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
| 296 if (source_) { | 296 if (source_) { |
| 297 source_->RemoveTrack(this); | 297 source_->RemoveTrack(this); |
| 298 source_ = NULL; | 298 source_ = NULL; |
| 299 } | 299 } |
| 300 OnReadyStateChanged(blink::WebMediaStreamSource::ReadyStateEnded); | 300 OnReadyStateChanged(blink::WebMediaStreamSource::ReadyStateEnded); |
| 301 } | 301 } |
| 302 | 302 |
| 303 void MediaStreamVideoTrack::getSettings( | 303 void MediaStreamVideoTrack::getSettings( |
| 304 blink::WebMediaStreamTrack::Settings& settings) { | 304 blink::WebMediaStreamTrack::Settings& settings) { |
| 305 // TODO(hta): Extract the real value. | |
| 306 settings.deviceId = blink::WebString("video device ID"); | |
| 307 if (!source_) | |
| 308 return; | |
| 309 | |
| 310 const media::VideoCaptureFormat* format = source_->GetCurrentFormat(); | 305 const media::VideoCaptureFormat* format = source_->GetCurrentFormat(); |
| 311 if (format) { | 306 if (format) { |
| 312 settings.frameRate = format->frame_rate; | 307 settings.frameRate = format->frame_rate; |
| 313 settings.width = format->frame_size.width(); | |
| 314 settings.height = format->frame_size.height(); | |
| 315 settings.videoKind = GetVideoKindForFormat(*format); | 308 settings.videoKind = GetVideoKindForFormat(*format); |
| 316 } | 309 } |
| 310 if (width_ && height_) { |
| 311 settings.width = width_; |
| 312 settings.height = height_; |
| 313 } |
| 317 switch (source_->device_info().device.video_facing) { | 314 switch (source_->device_info().device.video_facing) { |
| 318 case media::MEDIA_VIDEO_FACING_NONE: | 315 case media::MEDIA_VIDEO_FACING_NONE: |
| 319 settings.facingMode = blink::WebMediaStreamTrack::FacingMode::None; | 316 settings.facingMode = blink::WebMediaStreamTrack::FacingMode::None; |
| 320 break; | 317 break; |
| 321 case media::MEDIA_VIDEO_FACING_USER: | 318 case media::MEDIA_VIDEO_FACING_USER: |
| 322 settings.facingMode = blink::WebMediaStreamTrack::FacingMode::User; | 319 settings.facingMode = blink::WebMediaStreamTrack::FacingMode::User; |
| 323 break; | 320 break; |
| 324 case media::MEDIA_VIDEO_FACING_ENVIRONMENT: | 321 case media::MEDIA_VIDEO_FACING_ENVIRONMENT: |
| 325 settings.facingMode = blink::WebMediaStreamTrack::FacingMode::Environment; | 322 settings.facingMode = blink::WebMediaStreamTrack::FacingMode::Environment; |
| 326 break; | 323 break; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 339 } | 336 } |
| 340 | 337 |
| 341 void MediaStreamVideoTrack::OnReadyStateChanged( | 338 void MediaStreamVideoTrack::OnReadyStateChanged( |
| 342 blink::WebMediaStreamSource::ReadyState state) { | 339 blink::WebMediaStreamSource::ReadyState state) { |
| 343 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 340 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
| 344 for (auto* sink : sinks_) | 341 for (auto* sink : sinks_) |
| 345 sink->OnReadyStateChanged(state); | 342 sink->OnReadyStateChanged(state); |
| 346 } | 343 } |
| 347 | 344 |
| 348 } // namespace content | 345 } // namespace content |
| OLD | NEW |