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:
magjed
2016-10-08 02:57:50 -07:00
committed by Commit bot
parent c19f312f54
commit 9e31cca8f4

View File

@ -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: