Delete transitional method EncodedImage.maybeRetain

Bug: webrtc:9378
Change-Id: Ibe3d5bad835d1725faa38f8e2a804efc9272776e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/155661
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30072}
This commit is contained in:
Niels Möller
2019-10-04 16:17:48 +02:00
committed by Commit Bot
parent 3927298c22
commit 82f33c566a
7 changed files with 30 additions and 46 deletions

View File

@ -47,7 +47,6 @@ public class EncodedImage implements RefCounted {
}
private final RefCountDelegate refCountDelegate;
private final boolean supportsRetain;
public final ByteBuffer buffer;
public final int encodedWidth;
public final int encodedHeight;
@ -69,22 +68,10 @@ public class EncodedImage implements RefCounted {
refCountDelegate.release();
}
// A false return value means that the encoder expects that the buffer is no longer used after
// VideoEncoder.Callback.onEncodedFrame returns.
@CalledByNative
boolean maybeRetain() {
if (supportsRetain) {
retain();
return true;
} else {
return false;
}
}
@CalledByNative
private EncodedImage(ByteBuffer buffer, boolean supportsRetain,
@Nullable Runnable releaseCallback, int encodedWidth, int encodedHeight, long captureTimeNs,
FrameType frameType, int rotation, boolean completeFrame, @Nullable Integer qp) {
private EncodedImage(ByteBuffer buffer, @Nullable Runnable releaseCallback, int encodedWidth,
int encodedHeight, long captureTimeNs, FrameType frameType, int rotation,
boolean completeFrame, @Nullable Integer qp) {
this.buffer = buffer;
this.encodedWidth = encodedWidth;
this.encodedHeight = encodedHeight;
@ -94,7 +81,6 @@ public class EncodedImage implements RefCounted {
this.rotation = rotation;
this.completeFrame = completeFrame;
this.qp = qp;
this.supportsRetain = supportsRetain;
this.refCountDelegate = new RefCountDelegate(releaseCallback);
}
@ -144,7 +130,6 @@ public class EncodedImage implements RefCounted {
public static class Builder {
private ByteBuffer buffer;
private boolean supportsRetain;
private @Nullable Runnable releaseCallback;
private int encodedWidth;
private int encodedHeight;
@ -156,18 +141,9 @@ public class EncodedImage implements RefCounted {
private Builder() {}
@Deprecated
public Builder setBuffer(ByteBuffer buffer) {
this.buffer = buffer;
this.releaseCallback = null;
this.supportsRetain = false;
return this;
}
public Builder setBuffer(ByteBuffer buffer, @Nullable Runnable releaseCallback) {
this.buffer = buffer;
this.releaseCallback = releaseCallback;
this.supportsRetain = true;
return this;
}
@ -213,8 +189,8 @@ public class EncodedImage implements RefCounted {
}
public EncodedImage createEncodedImage() {
return new EncodedImage(buffer, supportsRetain, releaseCallback, encodedWidth, encodedHeight,
captureTimeNs, frameType, rotation, completeFrame, qp);
return new EncodedImage(buffer, releaseCallback, encodedWidth, encodedHeight, captureTimeNs,
frameType, rotation, completeFrame, qp);
}
}
}

View File

@ -18,7 +18,7 @@ package org.webrtc;
*/
public interface RefCounted {
/** Increases ref count by one. */
void retain();
@CalledByNative void retain();
/**
* Decreases ref count by one. When the ref count reaches zero, resources related to the object