Fix VideoCapturerAndroidTest.testStartWhileCameraIsAlreadyOpen on Android M.
Review URL: https://codereview.webrtc.org/1476313002 Cr-Commit-Position: refs/heads/master@{#10850}
This commit is contained in:
@ -416,6 +416,7 @@ public class VideoCapturerAndroidTestFixtures {
|
|||||||
static public void startWhileCameraIsAlreadyOpen(
|
static public void startWhileCameraIsAlreadyOpen(
|
||||||
VideoCapturerAndroid capturer, Context appContext) throws InterruptedException {
|
VideoCapturerAndroid capturer, Context appContext) throws InterruptedException {
|
||||||
Camera camera = Camera.open(capturer.getCurrentCameraId());
|
Camera camera = Camera.open(capturer.getCurrentCameraId());
|
||||||
|
|
||||||
final List<CaptureFormat> formats = capturer.getSupportedFormats();
|
final List<CaptureFormat> formats = capturer.getSupportedFormats();
|
||||||
final CameraEnumerationAndroid.CaptureFormat format = formats.get(0);
|
final CameraEnumerationAndroid.CaptureFormat format = formats.get(0);
|
||||||
|
|
||||||
@ -423,7 +424,14 @@ public class VideoCapturerAndroidTestFixtures {
|
|||||||
capturer.startCapture(format.width, format.height, format.maxFramerate,
|
capturer.startCapture(format.width, format.height, format.maxFramerate,
|
||||||
appContext, observer);
|
appContext, observer);
|
||||||
|
|
||||||
assertFalse(observer.WaitForCapturerToStart());
|
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||||
|
// The first opened camera client will be evicted.
|
||||||
|
assertTrue(observer.WaitForCapturerToStart());
|
||||||
|
capturer.stopCapture();
|
||||||
|
} else {
|
||||||
|
assertFalse(observer.WaitForCapturerToStart());
|
||||||
|
}
|
||||||
|
|
||||||
capturer.dispose();
|
capturer.dispose();
|
||||||
camera.release();
|
camera.release();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user