Release the analyzer mode placeholder surface

PiperOrigin-RevId: 670179138
This commit is contained in:
dancho 2024-09-02 05:06:35 -07:00 committed by Copybara-Service
parent b0213c870b
commit b3b4c80641

View File

@ -106,16 +106,16 @@ public final class ExperimentalAnalyzerModeFactory {
private static final String TAG = "DroppingEncoder"; private static final String TAG = "DroppingEncoder";
private static final int INTERNAL_BUFFER_SIZE = 8196; private static final int INTERNAL_BUFFER_SIZE = 8196;
private final Context context;
private final Format configurationFormat; private final Format configurationFormat;
private final ByteBuffer buffer; private final ByteBuffer buffer;
private final Surface placeholderSurface;
private boolean inputStreamEnded; private boolean inputStreamEnded;
public DroppingEncoder(Context context, Format format) { public DroppingEncoder(Context context, Format format) {
this.context = context;
this.configurationFormat = format; this.configurationFormat = format;
buffer = ByteBuffer.allocateDirect(INTERNAL_BUFFER_SIZE).order(ByteOrder.nativeOrder()); buffer = ByteBuffer.allocateDirect(INTERNAL_BUFFER_SIZE).order(ByteOrder.nativeOrder());
placeholderSurface = PlaceholderSurface.newInstance(context, /* secure= */ false);
} }
@Override @Override
@ -130,7 +130,7 @@ public final class ExperimentalAnalyzerModeFactory {
@Override @Override
public Surface getInputSurface() { public Surface getInputSurface() {
return PlaceholderSurface.newInstance(context, /* secure= */ false); return placeholderSurface;
} }
@Override @Override
@ -189,6 +189,8 @@ public final class ExperimentalAnalyzerModeFactory {
public void releaseOutputBuffer(long renderPresentationTimeUs) {} public void releaseOutputBuffer(long renderPresentationTimeUs) {}
@Override @Override
public void release() {} public void release() {
placeholderSurface.release();
}
} }
} }