Android: Let VideoSource dispose SurfaceTextureHelper

This CL is a follow-up to
https://webrtc-review.googlesource.com/c/src/+/71666 where a lot of code
was removed. Accidentally, the code that called
SurfaceTextureHelper.dispose() was removed. This code used to reside in
surfacetexturehelper.cc. This CL reintroduces the call to dispose in the
VideoSource.java backwards compatibility path.

Bug: webrtc:9181
Change-Id: I3e439dbf97965d806d238f7697561ac5ee9e79f1
Reviewed-on: https://webrtc-review.googlesource.com/73180
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23087}
This commit is contained in:
Magnus Jedvert
2018-05-02 14:41:22 +02:00
committed by Commit Bot
parent 2e28edaa8a
commit 26b9e12289
2 changed files with 21 additions and 6 deletions

View File

@ -75,9 +75,15 @@ public class VideoSource extends MediaSource {
frame.getBuffer().getHeight(), frame.getRotation(), frame.getTimestampNs(),
frame.getBuffer());
}
public void dispose() {
if (surfaceTextureHelper != null) {
surfaceTextureHelper.dispose();
}
}
}
private final VideoCapturer.CapturerObserver capturerObserver;
private final NativeCapturerObserver capturerObserver;
public VideoSource(long nativeSource) {
super(nativeSource);
@ -104,6 +110,12 @@ public class VideoSource extends MediaSource {
return capturerObserver;
}
@Override
public void dispose() {
capturerObserver.dispose();
super.dispose();
}
private static native void nativeAdaptOutputFormat(long source, int width, int height, int fps);
private static native void nativeCapturerStarted(long source, boolean success);
private static native void nativeCapturerStopped(long source);