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 5ac90771fb428e56ef303457d186e90c8adbbc75..c11d436da01f5493914a602ef27082ddcffc3100 100644 |
--- a/talk/app/webrtc/androidtests/src/org/webrtc/VideoCapturerAndroidTestFixtures.java |
+++ b/talk/app/webrtc/androidtests/src/org/webrtc/VideoCapturerAndroidTestFixtures.java |
@@ -311,8 +311,8 @@ public class VideoCapturerAndroidTestFixtures { |
assertTrue(observer.WaitForCapturerToStart()); |
observer.WaitForNextCapturedFrame(); |
capturer.stopCapture(); |
- for (long timeStamp : observer.getCopyAndResetListOftimeStamps()) { |
- capturer.returnBuffer(timeStamp); |
+ if (capturer.isCapturingToTexture()) { |
+ capturer.surfaceHelper.returnTextureFrame(); |
} |
capturer.dispose(); |
@@ -332,9 +332,10 @@ public class VideoCapturerAndroidTestFixtures { |
// Make sure camera is started and then stop it. |
assertTrue(observer.WaitForCapturerToStart()); |
capturer.stopCapture(); |
- for (long timeStamp : observer.getCopyAndResetListOftimeStamps()) { |
- capturer.returnBuffer(timeStamp); |
+ if (capturer.isCapturingToTexture()) { |
+ capturer.surfaceHelper.returnTextureFrame(); |
} |
+ |
// We can't change |capturer| at this point, but we should not crash. |
capturer.switchCamera(null); |
capturer.onOutputFormatRequest(640, 480, 15); |
@@ -396,8 +397,8 @@ public class VideoCapturerAndroidTestFixtures { |
assertEquals(format.frameSize(), observer.frameSize()); |
} |
capturer.stopCapture(); |
- for (long timestamp : observer.getCopyAndResetListOftimeStamps()) { |
- capturer.returnBuffer(timestamp); |
+ if (capturer.isCapturingToTexture()) { |
+ capturer.surfaceHelper.returnTextureFrame(); |
} |
} |
capturer.dispose(); |
@@ -455,8 +456,8 @@ public class VideoCapturerAndroidTestFixtures { |
assertTrue(observer.WaitForCapturerToStart()); |
observer.WaitForNextCapturedFrame(); |
capturer.stopCapture(); |
- for (long timeStamp : observer.getCopyAndResetListOftimeStamps()) { |
- capturer.returnBuffer(timeStamp); |
+ if (capturer.isCapturingToTexture()) { |
+ capturer.surfaceHelper.returnTextureFrame(); |
} |
capturer.dispose(); |
assertTrue(capturer.isReleased()); |
@@ -491,24 +492,24 @@ public class VideoCapturerAndroidTestFixtures { |
capturer.stopCapture(); |
List<Long> listOftimestamps = observer.getCopyAndResetListOftimeStamps(); |
assertTrue(listOftimestamps.size() >= 1); |
+ if (capturer.isCapturingToTexture()) { |
+ capturer.surfaceHelper.returnTextureFrame(); |
magjed_webrtc
2015/12/17 08:02:42
Why is this moved?
perkj_webrtc
2015/12/17 12:42:44
Done.
|
+ } |
format = formats.get(1); |
capturer.startCapture(format.width, format.height, format.maxFramerate, |
appContext, observer); |
observer.WaitForCapturerToStart(); |
- for (Long timeStamp : listOftimestamps) { |
- capturer.returnBuffer(timeStamp); |
- } |
- |
observer.WaitForNextCapturedFrame(); |
capturer.stopCapture(); |
listOftimestamps = observer.getCopyAndResetListOftimeStamps(); |
assertTrue(listOftimestamps.size() >= 1); |
- for (Long timeStamp : listOftimestamps) { |
- capturer.returnBuffer(timeStamp); |
+ if (capturer.isCapturingToTexture()) { |
+ capturer.surfaceHelper.returnTextureFrame(); |
} |
+ |
capturer.dispose(); |
assertTrue(capturer.isReleased()); |
} |
@@ -519,6 +520,7 @@ public class VideoCapturerAndroidTestFixtures { |
final VideoSource source = factory.createVideoSource(capturer, new MediaConstraints()); |
final VideoTrack track = factory.createVideoTrack("dummy", source); |
final FakeAsyncRenderer renderer = new FakeAsyncRenderer(); |
+ |
track.addRenderer(new VideoRenderer(renderer)); |
// Wait for at least one frame that has not been returned. |
assertFalse(renderer.waitForPendingFrames().isEmpty()); |
@@ -529,9 +531,7 @@ public class VideoCapturerAndroidTestFixtures { |
track.dispose(); |
source.dispose(); |
factory.dispose(); |
- |
- // The pending frames should keep the JNI parts and |capturer| alive. |
- assertFalse(capturer.isReleased()); |
+ assertTrue(capturer.isReleased()); |
// Return the frame(s), on a different thread out of spite. |
final List<I420Frame> pendingFrames = renderer.waitForPendingFrames(); |
@@ -545,13 +545,14 @@ public class VideoCapturerAndroidTestFixtures { |
}); |
returnThread.start(); |
returnThread.join(); |
- |
- // Check that frames have successfully returned. This will cause |capturer| to be released. |
- assertTrue(capturer.isReleased()); |
} |
- static public void cameraFreezedEventOnBufferStarvation(VideoCapturerAndroid capturer, |
+ static public void cameraFreezedEventOnBufferStarvationUsingTextures( |
+ VideoCapturerAndroid capturer, |
CameraEvents events, Context appContext) throws InterruptedException { |
+ if (!capturer.isCapturingToTexture()) { |
magjed_webrtc
2015/12/17 08:02:42
Use assertTrue("Not capturing to textures", captur
perkj_webrtc
2015/12/17 12:42:44
Done.
|
+ fail("Not capturing to textures"); |
+ } |
final List<CaptureFormat> formats = capturer.getSupportedFormats(); |
final CameraEnumerationAndroid.CaptureFormat format = formats.get(0); |
@@ -560,14 +561,15 @@ public class VideoCapturerAndroidTestFixtures { |
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.WaitForCameraFreezed()); |
+ // Since we don't return the buffer, we should get a starvation message if we are |
+ // capturing to a texture. |
+ assertEquals("Camera failure.", events.WaitForCameraFreezed()); |
capturer.stopCapture(); |
- for (long timeStamp : observer.getCopyAndResetListOftimeStamps()) { |
- capturer.returnBuffer(timeStamp); |
+ if (capturer.isCapturingToTexture()) { |
+ capturer.surfaceHelper.returnTextureFrame(); |
} |
+ |
capturer.dispose(); |
assertTrue(capturer.isReleased()); |
} |