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

Unified Diff: media/capture/video/linux/video_capture_device_chromeos.cc

Issue 2648743002: Rotate frames according to camera orientation (Closed)
Patch Set: removed {} for one-line blocks Created 3 years, 11 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: media/capture/video/linux/video_capture_device_chromeos.cc
diff --git a/media/capture/video/linux/video_capture_device_chromeos.cc b/media/capture/video/linux/video_capture_device_chromeos.cc
index 09047c718cc6abbdd1a2af55dd652a24979176c4..1d673def2bf62d98d223f703f257509b493fd5fa 100644
--- a/media/capture/video/linux/video_capture_device_chromeos.cc
+++ b/media/capture/video/linux/video_capture_device_chromeos.cc
@@ -20,7 +20,7 @@ namespace media {
namespace {
-base::LazyInstance<CameraFacingChromeOS>::Leaky g_camera_facing_ =
+base::LazyInstance<CameraConfigChromeOS>::Leaky g_camera_config_ =
LAZY_INSTANCE_INITIALIZER;
} // namespace
@@ -109,8 +109,11 @@ VideoCaptureDeviceChromeOS::VideoCaptureDeviceChromeOS(
screen_observer_delegate_(
new ScreenObserverDelegate(this, ui_task_runner)),
lens_facing_(
- g_camera_facing_.Get().GetCameraFacing(device_descriptor.device_id,
- device_descriptor.model_id)) {}
+ g_camera_config_.Get().GetCameraFacing(device_descriptor.device_id,
+ device_descriptor.model_id)),
+ camera_orientation_(
+ g_camera_config_.Get().GetOrientation(device_descriptor.device_id,
+ device_descriptor.model_id)) {}
VideoCaptureDeviceChromeOS::~VideoCaptureDeviceChromeOS() {
screen_observer_delegate_->RemoveObserver();
@@ -153,6 +156,8 @@ void VideoCaptureDeviceChromeOS::SetRotation(int rotation) {
// Therefore, for back camera, we need to rotate (360 - |rotation|).
rotation = (360 - rotation) % 360;
}
+ // Take into account camera orientation w.r.t. the display.
+ rotation = (rotation + camera_orientation_) % 360;
VideoCaptureDeviceLinux::SetRotation(rotation);
}

Powered by Google App Engine
This is Rietveld 408576698