Detect leaks of TextureBufferImpl objects.

The performance cost is not trivial but according to my profiling,
it is acceptable.

Bug: b/139745386
Change-Id: I0e63221ccf22e9f6fb32c630ff63a279e765994a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150539
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28973}
This commit is contained in:
Sami Kalliomäki
2019-08-27 15:09:15 +02:00
committed by Commit Bot
parent de21bf4cd3
commit 44bd29a3b0
2 changed files with 113 additions and 1 deletions

View File

@ -19,6 +19,8 @@ import android.support.annotation.Nullable;
* release callback. ToI420() is implemented by providing a Handler and a YuvConverter.
*/
public class TextureBufferImpl implements VideoFrame.TextureBuffer {
private static final int RELEASE_TIMEOUT_MS = 10000;
// This is the full resolution the texture has in memory after applying the transformation matrix
// that might include cropping. This resolution is useful to know when sampling the texture to
// avoid downscaling artifacts.
@ -60,7 +62,7 @@ public class TextureBufferImpl implements VideoFrame.TextureBuffer {
this.transformMatrix = transformMatrix;
this.toI420Handler = toI420Handler;
this.yuvConverter = yuvConverter;
this.refCountDelegate = new RefCountDelegate(releaseCallback);
this.refCountDelegate = new RefCountDelegate(releaseCallback, RELEASE_TIMEOUT_MS);
}
@Override