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

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

Issue 2793493003: Do not rotate frames from external cameras (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « media/capture/video/linux/video_capture_device_chromeos.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7003990ad5ee26c23d5dfc2445e6dc2e49cd5f37..3ba9f50330cc058623e577a62f8faadc5fbc7d30 100644
--- a/media/capture/video/linux/video_capture_device_chromeos.cc
+++ b/media/capture/video/linux/video_capture_device_chromeos.cc
@@ -110,16 +110,20 @@ VideoCaptureDeviceChromeOS::VideoCaptureDeviceChromeOS(
device_descriptor.model_id)),
camera_orientation_(
GetCameraConfig()->GetOrientation(device_descriptor.device_id,
- device_descriptor.model_id)) {}
+ device_descriptor.model_id)),
+ // External cameras have lens_facing as MEDIA_VIDEO_FACING_NONE.
+ // We don't want to rotate the frame even if the device rotates.
+ rotates_with_device_(lens_facing_ !=
+ VideoFacingMode::MEDIA_VIDEO_FACING_NONE) {}
VideoCaptureDeviceChromeOS::~VideoCaptureDeviceChromeOS() {
screen_observer_delegate_->RemoveObserver();
}
void VideoCaptureDeviceChromeOS::SetRotation(int rotation) {
- // We assume external camera is facing the users. If not, the users can
- // rotate the camera manually by themselves.
- if (lens_facing_ == VideoFacingMode::MEDIA_VIDEO_FACING_ENVIRONMENT) {
+ if (!rotates_with_device_) {
+ rotation = 0;
+ } else if (lens_facing_ == VideoFacingMode::MEDIA_VIDEO_FACING_ENVIRONMENT) {
// Original frame when |rotation| = 0
// -----------------------
// | * |
@@ -153,7 +157,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.
+ // Take into account camera orientation w.r.t. the display. External cameras
+ // would have camera_orientation_ as 0.
rotation = (rotation + camera_orientation_) % 360;
VideoCaptureDeviceLinux::SetRotation(rotation);
}
« no previous file with comments | « media/capture/video/linux/video_capture_device_chromeos.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698