Commit afc549fb by apodob Committed by bachinger

Release subtitle outputBuffer after decoding.

PiperOrigin-RevId: 391509443
parent dfb9ac11
...@@ -181,8 +181,8 @@ public class SubtitleExtractor implements Extractor { ...@@ -181,8 +181,8 @@ public class SubtitleExtractor implements Extractor {
try { try {
@Nullable SubtitleInputBuffer inputBuffer = subtitleDecoder.dequeueInputBuffer(); @Nullable SubtitleInputBuffer inputBuffer = subtitleDecoder.dequeueInputBuffer();
while (inputBuffer == null) { while (inputBuffer == null) {
inputBuffer = subtitleDecoder.dequeueInputBuffer();
Thread.sleep(5); Thread.sleep(5);
inputBuffer = subtitleDecoder.dequeueInputBuffer();
} }
inputBuffer.ensureSpaceForWrite(bytesRead); inputBuffer.ensureSpaceForWrite(bytesRead);
inputBuffer.data.put(subtitleData.getData(), /* offset= */ 0, bytesRead); inputBuffer.data.put(subtitleData.getData(), /* offset= */ 0, bytesRead);
...@@ -200,8 +200,8 @@ public class SubtitleExtractor implements Extractor { ...@@ -200,8 +200,8 @@ public class SubtitleExtractor implements Extractor {
try { try {
@Nullable SubtitleOutputBuffer outputBuffer = subtitleDecoder.dequeueOutputBuffer(); @Nullable SubtitleOutputBuffer outputBuffer = subtitleDecoder.dequeueOutputBuffer();
while (outputBuffer == null) { while (outputBuffer == null) {
outputBuffer = subtitleDecoder.dequeueOutputBuffer();
Thread.sleep(5); Thread.sleep(5);
outputBuffer = subtitleDecoder.dequeueOutputBuffer();
} }
for (int i = 0; i < outputBuffer.getEventTimeCount(); i++) { for (int i = 0; i < outputBuffer.getEventTimeCount(); i++) {
...@@ -215,6 +215,7 @@ public class SubtitleExtractor implements Extractor { ...@@ -215,6 +215,7 @@ public class SubtitleExtractor implements Extractor {
/* offset= */ 0, /* offset= */ 0,
/* cryptoData= */ null); /* cryptoData= */ null);
} }
outputBuffer.release();
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
throw new InterruptedIOException(); throw new InterruptedIOException();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment