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

Unified Diff: talk/app/webrtc/androidtests/src/org/webrtc/VideoCapturerAndroidTestFixtures.java

Issue 1415013006: Changed timeout to 6s for reporting android camera freeze. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 1 month 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
Index: talk/app/webrtc/androidtests/src/org/webrtc/VideoCapturerAndroidTestFixtures.java
diff --git a/talk/app/webrtc/androidtests/src/org/webrtc/VideoCapturerAndroidTestFixtures.java b/talk/app/webrtc/androidtests/src/org/webrtc/VideoCapturerAndroidTestFixtures.java
index 11b3ce98a092f080767bc11ef5296282b5c8fd5f..237c6d8a493cfdc89ac1a4e2d169af365db0638a 100644
--- a/talk/app/webrtc/androidtests/src/org/webrtc/VideoCapturerAndroidTestFixtures.java
+++ b/talk/app/webrtc/androidtests/src/org/webrtc/VideoCapturerAndroidTestFixtures.java
@@ -174,9 +174,16 @@ public class VideoCapturerAndroidTestFixtures {
VideoCapturerAndroid.CameraEventsHandler {
public boolean onCameraOpeningCalled;
public boolean onFirstFrameAvailableCalled;
+ public final Object onCameraErrorLock = new Object();
+ private String onCameraErrorDescription;
@Override
- public void onCameraError(String errorDescription) { }
+ public void onCameraError(String errorDescription) {
+ synchronized (onCameraErrorLock) {
+ onCameraErrorDescription = errorDescription;
+ onCameraErrorLock.notifyAll();
+ }
+ }
@Override
public void onCameraOpening(int cameraId) {
@@ -190,6 +197,13 @@ public class VideoCapturerAndroidTestFixtures {
@Override
public void onCameraClosed() { }
+
+ public String WaitForCameraError() throws InterruptedException {
+ synchronized (onCameraErrorLock) {
+ onCameraErrorLock.wait();
+ return onCameraErrorDescription;
+ }
+ }
}
static public CameraEvents createCameraEvents() {
@@ -440,4 +454,25 @@ public class VideoCapturerAndroidTestFixtures {
// Check that frames have successfully returned. This will cause |capturer| to be released.
assertTrue(capturer.isReleased());
}
+
+ static public void cameraErrorEventOnBufferStarvation(VideoCapturerAndroid capturer,
+ CameraEvents events, Context appContext) throws InterruptedException {
+ final List<CaptureFormat> formats = capturer.getSupportedFormats();
+ final CameraEnumerationAndroid.CaptureFormat format = formats.get(0);
+
+ final FakeCapturerObserver observer = new FakeCapturerObserver();
+ capturer.startCapture(format.width, format.height, format.maxFramerate,
+ appContext, observer);
+ // Make sure camera is started.
+ assertTrue(observer.WaitForCapturerToStart());
+ // Since we don't call returnBuffer, we should get a starvation message.
+ assertEquals("Camera failure. Client must return video buffers.", events.WaitForCameraError());
+
+ capturer.stopCapture();
+ for (long timeStamp : observer.getCopyAndResetListOftimeStamps()) {
+ capturer.returnBuffer(timeStamp);
+ }
+ capturer.dispose();
+ assertTrue(capturer.isReleased());
+ }
}

Powered by Google App Engine
This is Rietveld 408576698