Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(594)

Unified Diff: content/renderer/media/media_stream_video_track.cc

Issue 2606983002: Media Capture Depth Stream Extensions API: focal length and depth range. (Closed)
Patch Set: 80-char line fix in test html. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/media_stream_video_track.cc
diff --git a/content/renderer/media/media_stream_video_track.cc b/content/renderer/media/media_stream_video_track.cc
index 966bfe48bc3edcce67a9f0db0bff615c99bab9c6..23e0ab95913510e0783918533d252a97b589a764 100644
--- a/content/renderer/media/media_stream_video_track.cc
+++ b/content/renderer/media/media_stream_video_track.cc
@@ -301,31 +301,39 @@ void MediaStreamVideoTrack::Stop() {
void MediaStreamVideoTrack::getSettings(
blink::WebMediaStreamTrack::Settings& settings) {
- if (source_) {
- const media::VideoCaptureFormat* format = source_->GetCurrentFormat();
- if (format) {
- settings.frameRate = format->frame_rate;
- settings.width = format->frame_size.width();
- settings.height = format->frame_size.height();
- }
- switch (source_->device_info().device.video_facing) {
- case media::MEDIA_VIDEO_FACING_NONE:
- settings.facingMode = blink::WebMediaStreamTrack::FacingMode::None;
- break;
- case media::MEDIA_VIDEO_FACING_USER:
- settings.facingMode = blink::WebMediaStreamTrack::FacingMode::User;
- break;
- case media::MEDIA_VIDEO_FACING_ENVIRONMENT:
- settings.facingMode =
- blink::WebMediaStreamTrack::FacingMode::Environment;
- break;
- default:
- settings.facingMode = blink::WebMediaStreamTrack::FacingMode::None;
- break;
- }
- }
// TODO(hta): Extract the real value.
settings.deviceId = blink::WebString("video device ID");
+ if (!source_)
+ return;
+
+ const media::VideoCaptureFormat* format = source_->GetCurrentFormat();
+ if (format) {
+ settings.frameRate = format->frame_rate;
+ settings.width = format->frame_size.width();
+ settings.height = format->frame_size.height();
+ }
+ switch (source_->device_info().device.video_facing) {
+ case media::MEDIA_VIDEO_FACING_NONE:
+ settings.facingMode = blink::WebMediaStreamTrack::FacingMode::None;
+ break;
+ case media::MEDIA_VIDEO_FACING_USER:
+ settings.facingMode = blink::WebMediaStreamTrack::FacingMode::User;
+ break;
+ case media::MEDIA_VIDEO_FACING_ENVIRONMENT:
+ settings.facingMode = blink::WebMediaStreamTrack::FacingMode::Environment;
+ break;
+ default:
+ settings.facingMode = blink::WebMediaStreamTrack::FacingMode::None;
+ break;
+ }
+ const base::Optional<CameraCalibration> calibration =
+ source_->device_info().device.camera_calibration;
+ if (calibration) {
+ settings.depthNear = calibration->depth_near;
+ settings.depthFar = calibration->depth_far;
+ settings.focalLengthX = calibration->focal_length_x;
+ settings.focalLengthY = calibration->focal_length_y;
+ }
}
void MediaStreamVideoTrack::OnReadyStateChanged(
« no previous file with comments | « content/public/common/media_stream_request.h ('k') | content/test/data/media/getusermedia-depth-capture.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698