Use a video renderer instead of a capture observer in VideoCapturerAndroidTest.
In org.webrtc.VideoCapturerAndroidTest#startWhileCameraIsAlreadyOpenAndCloseCamera, use a video renderer instead of a capture observer. The video renderer automatically returns the texture buffers, which resolves the bug. There shouldn't be any changes to the effectiveness of the test. BUG=webrtc:5982 Review-Url: https://codereview.webrtc.org/2042283004 Cr-Commit-Position: refs/heads/master@{#13085}
This commit is contained in:
parent
1503df6aef
commit
d9f3d56bb6
@ -426,26 +426,24 @@ public class VideoCapturerAndroidTestFixtures {
|
||||
|
||||
static public void startWhileCameraIsAlreadyOpenAndCloseCamera(
|
||||
VideoCapturerAndroid capturer, Context appContext) throws InterruptedException {
|
||||
final PeerConnectionFactory factory = new PeerConnectionFactory(null /* options */);
|
||||
final List<CaptureFormat> formats = capturer.getSupportedFormats();
|
||||
final CameraEnumerationAndroid.CaptureFormat format = formats.get(0);
|
||||
android.hardware.Camera camera = android.hardware.Camera.open(capturer.getCurrentCameraId());
|
||||
|
||||
final SurfaceTextureHelper surfaceTextureHelper = SurfaceTextureHelper.create(
|
||||
"SurfaceTextureHelper test" /* threadName */, null /* sharedContext */);
|
||||
final FakeCapturerObserver observer = new FakeCapturerObserver();
|
||||
capturer.startCapture(format.width, format.height, format.framerate.max,
|
||||
surfaceTextureHelper, appContext, observer);
|
||||
final VideoSource source = factory.createVideoSource(capturer, new MediaConstraints());
|
||||
final VideoTrack track = factory.createVideoTrack("dummy", source);
|
||||
final RendererCallbacks callbacks = new RendererCallbacks();
|
||||
track.addRenderer(new VideoRenderer(callbacks));
|
||||
waitUntilIdle(capturer);
|
||||
|
||||
camera.release();
|
||||
|
||||
// Make sure camera is started and first frame is received and then stop it.
|
||||
assertTrue(observer.WaitForCapturerToStart());
|
||||
observer.WaitForNextCapturedFrame();
|
||||
callbacks.WaitForNextFrameToRender();
|
||||
capturer.stopCapture();
|
||||
if (capturer.isCapturingToTexture()) {
|
||||
surfaceTextureHelper.returnTextureFrame();
|
||||
}
|
||||
release(capturer);
|
||||
surfaceTextureHelper.dispose();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user