Update Android camera switch API to allow specifying a name

The current camera switch API sequentially cycles through each
camera name for each method invocation. This policy provides
reasonable behavior for devices with 2 or 3 cameras, but
presents challenges with devices that contain several cameras.
For example in a scenario where the current camera is oriented
on the same side as the next camera name, a developer would need to
call switchCamera multiple times to capture from a camera oriented on
a different side of the device.

This commit allows a developer to specify a camera name when switching
cameras. This flexibility allows developers to have more control over
which device they switch to in cases where a device contains several cameras.

Bug: webrtc:11261
Change-Id: I93d46d70b2c7cf735a411a4ef4f33e926bf3a5ea
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/165040
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30199}
This commit is contained in:
Aaron Alaniz
2020-01-09 04:26:04 +00:00
committed by Commit Bot
parent e1cbb9c20e
commit 415e39da56
7 changed files with 85 additions and 27 deletions

View File

@ -237,6 +237,12 @@ public class Camera2CapturerTest {
fixtures.switchCamera();
}
@Test
@MediumTest
public void testSwitchVideoCapturerToSpecificCameraName() throws InterruptedException {
fixtures.switchCamera(true /* specifyCameraName */);
}
@Test
@MediumTest
public void testCameraEvents() throws InterruptedException {