VideoCapturerAndroidTestFixtures: Fix deprecation compile warnings
This CL removes compile warnings such as:
[4520/4630] ACTION Compiling java for libjingle_peerconnection_android_unittest
androidtests/src/org/webrtc/VideoCapturerAndroidTestFixtures.java:13: warning: [deprecation] Camera in android.hardware has been deprecated
import android.hardware.Camera;
Review-Url: https://codereview.webrtc.org/2024083002
Cr-Commit-Position: refs/heads/master@{#12970}
diff --git a/webrtc/api/androidtests/src/org/webrtc/VideoCapturerAndroidTestFixtures.java b/webrtc/api/androidtests/src/org/webrtc/VideoCapturerAndroidTestFixtures.java
index 04643f1..6c4a6ea 100644
--- a/webrtc/api/androidtests/src/org/webrtc/VideoCapturerAndroidTestFixtures.java
+++ b/webrtc/api/androidtests/src/org/webrtc/VideoCapturerAndroidTestFixtures.java
@@ -10,7 +10,6 @@
package org.webrtc;
import android.content.Context;
-import android.hardware.Camera;
import org.webrtc.VideoCapturerAndroidTestFixtures;
import org.webrtc.CameraEnumerationAndroid.CaptureFormat;
@@ -22,6 +21,7 @@
import static junit.framework.Assert.*;
+@SuppressWarnings("deprecation")
public class VideoCapturerAndroidTestFixtures {
static class RendererCallbacks implements VideoRenderer.Callbacks {
private int framesRendered = 0;
@@ -217,7 +217,7 @@
// Return true if the device under test have at least two cameras.
@SuppressWarnings("deprecation")
static public boolean HaveTwoCameras() {
- return (Camera.getNumberOfCameras() >= 2);
+ return (android.hardware.Camera.getNumberOfCameras() >= 2);
}
static public void release(VideoCapturerAndroid capturer) {
@@ -227,7 +227,7 @@
static public void startCapturerAndRender(VideoCapturerAndroid capturer)
throws InterruptedException {
- PeerConnectionFactory factory = new PeerConnectionFactory();
+ PeerConnectionFactory factory = new PeerConnectionFactory(null /* options */);
VideoSource source =
factory.createVideoSource(capturer, new MediaConstraints());
VideoTrack track = factory.createVideoTrack("dummy", source);
@@ -240,7 +240,7 @@
}
static public void switchCamera(VideoCapturerAndroid capturer) throws InterruptedException {
- PeerConnectionFactory factory = new PeerConnectionFactory();
+ PeerConnectionFactory factory = new PeerConnectionFactory(null /* options */);
VideoSource source =
factory.createVideoSource(capturer, new MediaConstraints());
VideoTrack track = factory.createVideoTrack("dummy", source);
@@ -330,7 +330,7 @@
static public void stopRestartVideoSource(VideoCapturerAndroid capturer)
throws InterruptedException {
- PeerConnectionFactory factory = new PeerConnectionFactory();
+ PeerConnectionFactory factory = new PeerConnectionFactory(null /* options */);
VideoSource source =
factory.createVideoSource(capturer, new MediaConstraints());
VideoTrack track = factory.createVideoTrack("dummy", source);
@@ -403,7 +403,7 @@
VideoCapturerAndroid capturer, Context appContext) throws InterruptedException {
final List<CaptureFormat> formats = capturer.getSupportedFormats();
final CameraEnumerationAndroid.CaptureFormat format = formats.get(0);
- Camera camera = Camera.open(capturer.getCurrentCameraId());
+ android.hardware.Camera camera = android.hardware.Camera.open(capturer.getCurrentCameraId());
final SurfaceTextureHelper surfaceTextureHelper = SurfaceTextureHelper.create(
"SurfaceTextureHelper test" /* threadName */, null /* sharedContext */);
@@ -428,7 +428,7 @@
VideoCapturerAndroid capturer, Context appContext) throws InterruptedException {
final List<CaptureFormat> formats = capturer.getSupportedFormats();
final CameraEnumerationAndroid.CaptureFormat format = formats.get(0);
- Camera camera = Camera.open(capturer.getCurrentCameraId());
+ android.hardware.Camera camera = android.hardware.Camera.open(capturer.getCurrentCameraId());
final SurfaceTextureHelper surfaceTextureHelper = SurfaceTextureHelper.create(
"SurfaceTextureHelper test" /* threadName */, null /* sharedContext */);
@@ -454,7 +454,7 @@
VideoCapturerAndroid capturer, Context appContext) throws InterruptedException {
final List<CaptureFormat> formats = capturer.getSupportedFormats();
final CameraEnumerationAndroid.CaptureFormat format = formats.get(0);
- Camera camera = Camera.open(capturer.getCurrentCameraId());
+ android.hardware.Camera camera = android.hardware.Camera.open(capturer.getCurrentCameraId());
final SurfaceTextureHelper surfaceTextureHelper = SurfaceTextureHelper.create(
"SurfaceTextureHelper test" /* threadName */, null /* sharedContext */);
@@ -507,7 +507,7 @@
static public void returnBufferLateEndToEnd(VideoCapturerAndroid capturer)
throws InterruptedException {
- final PeerConnectionFactory factory = new PeerConnectionFactory();
+ final PeerConnectionFactory factory = new PeerConnectionFactory(null /* options */);
final VideoSource source = factory.createVideoSource(capturer, new MediaConstraints());
final VideoTrack track = factory.createVideoTrack("dummy", source);
final FakeAsyncRenderer renderer = new FakeAsyncRenderer();
@@ -567,7 +567,7 @@
}
static public void scaleCameraOutput(VideoCapturerAndroid capturer) throws InterruptedException {
- PeerConnectionFactory factory = new PeerConnectionFactory();
+ PeerConnectionFactory factory = new PeerConnectionFactory(null /* options */);
VideoSource source =
factory.createVideoSource(capturer, new MediaConstraints());
VideoTrack track = factory.createVideoTrack("dummy", source);