mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Release subtitle outputBuffer after decoding.
PiperOrigin-RevId: 391509443
This commit is contained in:
parent
dfb9ac11e9
commit
afc549fba4
1 changed files with 3 additions and 2 deletions
|
|
@ -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 {
|
||||||
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 {
|
||||||
/* 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();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue