Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "media/capture/video/linux/video_capture_device_chromeos.h" | 5 #include "media/capture/video/linux/video_capture_device_chromeos.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 // | ******** | | 145 // | ******** | |
| 146 // | **** * | | 146 // | **** * | |
| 147 // | *** * | | 147 // | *** * | |
| 148 // | *** * | | 148 // | *** * | |
| 149 // | **** * | | 149 // | **** * | |
| 150 // | ******** | | 150 // | ******** | |
| 151 // ----------------------- | 151 // ----------------------- |
| 152 // | 152 // |
| 153 // Therefore, for back camera, we need to rotate (360 - |rotation|). | 153 // Therefore, for back camera, we need to rotate (360 - |rotation|). |
| 154 rotation = (360 - rotation) % 360; | 154 rotation = (360 - rotation) % 360; |
| 155 } else if (lens_facing_ == VideoFacingMode::MEDIA_VIDEO_FACING_NONE) { | |
| 156 // External cameras have lens_facing as MEDIA_VIDEO_FACING_NONE. | |
| 157 // We don't want to rotate the frame even if the device rotates. | |
| 158 rotation = 0; | |
|
chfremer
2017/03/20 16:32:47
As a drive-by nit, I wonder if we could make thing
shenghao
2017/03/21 06:06:31
Done.
| |
| 155 } | 159 } |
| 156 // Take into account camera orientation w.r.t. the display. | 160 // Take into account camera orientation w.r.t. the display. External cameras |
| 161 // would have camera_orientation_ as 0. | |
| 157 rotation = (rotation + camera_orientation_) % 360; | 162 rotation = (rotation + camera_orientation_) % 360; |
| 158 VideoCaptureDeviceLinux::SetRotation(rotation); | 163 VideoCaptureDeviceLinux::SetRotation(rotation); |
| 159 } | 164 } |
| 160 | 165 |
| 161 void VideoCaptureDeviceChromeOS::SetDisplayRotation( | 166 void VideoCaptureDeviceChromeOS::SetDisplayRotation( |
| 162 const display::Display& display) { | 167 const display::Display& display) { |
| 163 if (display.IsInternal()) | 168 if (display.IsInternal()) |
| 164 SetRotation(display.rotation() * 90); | 169 SetRotation(display.rotation() * 90); |
| 165 } | 170 } |
| 166 | 171 |
| 167 } // namespace media | 172 } // namespace media |
| OLD | NEW |