Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Unified Diff: webrtc/api/androidtests/src/org/webrtc/VideoCapturerAndroidTestFixtures.java

Issue 1696553003: Android: Make VideoCapturer an interface for all VideoCapturers to implement (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Replace 'replace' with 'dispose' in jni as well Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/api/androidvideocapturer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/androidtests/src/org/webrtc/VideoCapturerAndroidTestFixtures.java
diff --git a/webrtc/api/androidtests/src/org/webrtc/VideoCapturerAndroidTestFixtures.java b/webrtc/api/androidtests/src/org/webrtc/VideoCapturerAndroidTestFixtures.java
index 4b41611032dd0f17e1be379932b1f6eea7f4d4b0..ae82a9fef6f881d96f79e76b972adc0d375e3dd7 100644
--- a/webrtc/api/androidtests/src/org/webrtc/VideoCapturerAndroidTestFixtures.java
+++ b/webrtc/api/androidtests/src/org/webrtc/VideoCapturerAndroidTestFixtures.java
@@ -82,8 +82,7 @@ public class VideoCapturerAndroidTestFixtures {
}
}
- static class FakeCapturerObserver implements
- VideoCapturerAndroid.CapturerObserver {
+ static class FakeCapturerObserver implements VideoCapturer.CapturerObserver {
private int framesCaptured = 0;
private int frameSize = 0;
private int frameWidth = 0;
@@ -224,7 +223,7 @@ public class VideoCapturerAndroidTestFixtures {
static public void release(VideoCapturerAndroid capturer) {
assertNotNull(capturer);
capturer.dispose();
- assertTrue(capturer.isReleased());
+ assertTrue(capturer.isDisposed());
}
static public void startCapturerAndRender(VideoCapturerAndroid capturer)
@@ -239,7 +238,7 @@ public class VideoCapturerAndroidTestFixtures {
track.dispose();
source.dispose();
factory.dispose();
- assertTrue(capturer.isReleased());
+ assertTrue(capturer.isDisposed());
}
static public void switchCamera(VideoCapturerAndroid capturer) throws InterruptedException {
@@ -279,7 +278,7 @@ public class VideoCapturerAndroidTestFixtures {
track.dispose();
source.dispose();
factory.dispose();
- assertTrue(capturer.isReleased());
+ assertTrue(capturer.isDisposed());
}
static public void cameraEventsInvoked(VideoCapturerAndroid capturer, CameraEvents events,
@@ -297,9 +296,8 @@ public class VideoCapturerAndroidTestFixtures {
if (capturer.isCapturingToTexture()) {
capturer.surfaceHelper.returnTextureFrame();
}
- capturer.dispose();
+ release(capturer);
- assertTrue(capturer.isReleased());
assertTrue(events.onCameraOpeningCalled);
assertTrue(events.onFirstFrameAvailableCalled);
}
@@ -324,8 +322,7 @@ public class VideoCapturerAndroidTestFixtures {
capturer.onOutputFormatRequest(640, 480, 15);
capturer.changeCaptureFormat(640, 480, 15);
- capturer.dispose();
- assertTrue(capturer.isReleased());
+ release(capturer);
}
static public void stopRestartVideoSource(VideoCapturerAndroid capturer)
@@ -348,7 +345,7 @@ public class VideoCapturerAndroidTestFixtures {
track.dispose();
source.dispose();
factory.dispose();
- assertTrue(capturer.isReleased());
+ assertTrue(capturer.isDisposed());
}
static public void startStopWithDifferentResolutions(VideoCapturerAndroid capturer,
@@ -384,8 +381,7 @@ public class VideoCapturerAndroidTestFixtures {
capturer.surfaceHelper.returnTextureFrame();
}
}
- capturer.dispose();
- assertTrue(capturer.isReleased());
+ release(capturer);
}
static void waitUntilIdle(VideoCapturerAndroid capturer) throws InterruptedException {
@@ -400,10 +396,9 @@ public class VideoCapturerAndroidTestFixtures {
static public void startWhileCameraIsAlreadyOpen(
VideoCapturerAndroid capturer, Context appContext) throws InterruptedException {
- Camera camera = Camera.open(capturer.getCurrentCameraId());
-
final List<CaptureFormat> formats = capturer.getSupportedFormats();
final CameraEnumerationAndroid.CaptureFormat format = formats.get(0);
+ Camera camera = Camera.open(capturer.getCurrentCameraId());
final FakeCapturerObserver observer = new FakeCapturerObserver();
capturer.startCapture(format.width, format.height, format.maxFramerate,
@@ -417,16 +412,15 @@ public class VideoCapturerAndroidTestFixtures {
assertFalse(observer.WaitForCapturerToStart());
}
- capturer.dispose();
+ release(capturer);
camera.release();
}
static public void startWhileCameraIsAlreadyOpenAndCloseCamera(
VideoCapturerAndroid capturer, Context appContext) throws InterruptedException {
- Camera camera = Camera.open(capturer.getCurrentCameraId());
-
final List<CaptureFormat> formats = capturer.getSupportedFormats();
final CameraEnumerationAndroid.CaptureFormat format = formats.get(0);
+ Camera camera = Camera.open(capturer.getCurrentCameraId());
final FakeCapturerObserver observer = new FakeCapturerObserver();
capturer.startCapture(format.width, format.height, format.maxFramerate,
@@ -442,22 +436,20 @@ public class VideoCapturerAndroidTestFixtures {
if (capturer.isCapturingToTexture()) {
capturer.surfaceHelper.returnTextureFrame();
}
- capturer.dispose();
- assertTrue(capturer.isReleased());
+ release(capturer);
}
static public void startWhileCameraIsAlreadyOpenAndStop(
VideoCapturerAndroid capturer, Context appContext) throws InterruptedException {
- Camera camera = Camera.open(capturer.getCurrentCameraId());
final List<CaptureFormat> formats = capturer.getSupportedFormats();
final CameraEnumerationAndroid.CaptureFormat format = formats.get(0);
+ Camera camera = Camera.open(capturer.getCurrentCameraId());
final FakeCapturerObserver observer = new FakeCapturerObserver();
capturer.startCapture(format.width, format.height, format.maxFramerate,
appContext, observer);
capturer.stopCapture();
- capturer.dispose();
- assertTrue(capturer.isReleased());
+ release(capturer);
camera.release();
}
@@ -493,8 +485,7 @@ public class VideoCapturerAndroidTestFixtures {
capturer.surfaceHelper.returnTextureFrame();
}
- capturer.dispose();
- assertTrue(capturer.isReleased());
+ release(capturer);
}
static public void returnBufferLateEndToEnd(VideoCapturerAndroid capturer)
@@ -514,7 +505,7 @@ public class VideoCapturerAndroidTestFixtures {
track.dispose();
source.dispose();
factory.dispose();
- assertTrue(capturer.isReleased());
+ assertTrue(capturer.isDisposed());
// Return the frame(s), on a different thread out of spite.
final List<I420Frame> pendingFrames = renderer.waitForPendingFrames();
@@ -553,8 +544,7 @@ public class VideoCapturerAndroidTestFixtures {
capturer.surfaceHelper.returnTextureFrame();
}
- capturer.dispose();
- assertTrue(capturer.isReleased());
+ release(capturer);
}
static public void scaleCameraOutput(VideoCapturerAndroid capturer) throws InterruptedException {
@@ -590,7 +580,7 @@ public class VideoCapturerAndroidTestFixtures {
track.dispose();
source.dispose();
factory.dispose();
- assertTrue(capturer.isReleased());
+ assertTrue(capturer.isDisposed());
assertTrue(gotExpectedResolution);
}
« no previous file with comments | « no previous file | webrtc/api/androidvideocapturer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698