| 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);
|
| }
|
|
|