Android: Guard against switching camera on stopped camera

It is possible that cameraThreadHandler is null upon calling
switchCamera(). This CL adds a guard against that.

Review URL: https://codereview.webrtc.org/1325333003

Cr-Commit-Position: refs/heads/master@{#9925}
This commit is contained in:
colin 2015-09-11 06:30:32 -07:00 committed by Commit bot
parent c68700f717
commit 92068ee683
2 changed files with 4 additions and 3 deletions

View File

@ -40,5 +40,6 @@ MIPS Technologies
Mozilla Foundation
Opera Software ASA
struktur AG
Telenor Digital AS
Temasys Communications
Vonage Holdings Corp.

View File

@ -168,9 +168,9 @@ public class VideoCapturerAndroid extends VideoCapturer implements PreviewCallba
if (Camera.getNumberOfCameras() < 2 )
return false;
if (cameraThread == null) {
Log.e(TAG, "Camera has not been started");
return false;
if (cameraThreadHandler == null) {
Log.e(TAG, "Calling switchCamera() for stopped camera.");
return false;
}
if (pendingCameraSwitch) {
// Do not handle multiple camera switch request to avoid blocking