iOS: Fix rotation bug for back camera
The rotation is currently incorrect for the back camera in landscape mode. The reason is that device rotation needs to be reversed for the back camera compared to the front camera. The camera sensor can also be mounted with a specific orientation. So when front camera rotation goes through: 0->90->180->270, back camera rotation goes in reverse: 180->90->0->270. BUG=b/31984246,b/30651939 Review-Url: https://codereview.webrtc.org/2401033002 Cr-Commit-Position: refs/heads/master@{#14580}
This commit is contained in:
@ -630,10 +630,12 @@ static BOOL SetFormatForCaptureDevice(AVCaptureDevice *device,
|
||||
_rotation = webrtc::kVideoRotation_270;
|
||||
break;
|
||||
case UIDeviceOrientationLandscapeLeft:
|
||||
_rotation = webrtc::kVideoRotation_180;
|
||||
_rotation = _capturer->GetUseBackCamera() ? webrtc::kVideoRotation_0
|
||||
: webrtc::kVideoRotation_180;
|
||||
break;
|
||||
case UIDeviceOrientationLandscapeRight:
|
||||
_rotation = webrtc::kVideoRotation_0;
|
||||
_rotation = _capturer->GetUseBackCamera() ? webrtc::kVideoRotation_180
|
||||
: webrtc::kVideoRotation_0;
|
||||
break;
|
||||
case UIDeviceOrientationFaceUp:
|
||||
case UIDeviceOrientationFaceDown:
|
||||
|
||||
Reference in New Issue
Block a user