Commit 87e790f4 by cdrolle Committed by Oliver Woodman

Fixed issue with TextRenderer and RawCC 608/708 captions in which all the…

Fixed issue with TextRenderer and RawCC 608/708 captions in which all the captions prior to the playback position would be rendered in [] succession when a VOD stream starts.

Instead of clearing the DECODE_ONLY flag for all input buffers in TextRenderer (i.e. for all caption types), we now only clear it on the output buffer in SimpleSubtitleDecoder. The number if input buffers in CeaDecoder has also been increased to reduce the delay before captions appear for playback sessions that start far ahead into the content.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146028680
parent 6a844ebc
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
*/ */
package com.google.android.exoplayer2.text; package com.google.android.exoplayer2.text;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.decoder.SimpleDecoder; import com.google.android.exoplayer2.decoder.SimpleDecoder;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
...@@ -68,6 +69,8 @@ public abstract class SimpleSubtitleDecoder extends ...@@ -68,6 +69,8 @@ public abstract class SimpleSubtitleDecoder extends
ByteBuffer inputData = inputBuffer.data; ByteBuffer inputData = inputBuffer.data;
Subtitle subtitle = decode(inputData.array(), inputData.limit()); Subtitle subtitle = decode(inputData.array(), inputData.limit());
outputBuffer.setContent(inputBuffer.timeUs, subtitle, inputBuffer.subsampleOffsetUs); outputBuffer.setContent(inputBuffer.timeUs, subtitle, inputBuffer.subsampleOffsetUs);
// Clear BUFFER_FLAG_DECODE_ONLY (see [Internal: b/27893809]).
outputBuffer.clearFlag(C.BUFFER_FLAG_DECODE_ONLY);
return null; return null;
} catch (SubtitleDecoderException e) { } catch (SubtitleDecoderException e) {
return e; return e;
......
...@@ -191,8 +191,6 @@ public final class TextRenderer extends BaseRenderer implements Callback { ...@@ -191,8 +191,6 @@ public final class TextRenderer extends BaseRenderer implements Callback {
// Try and read the next subtitle from the source. // Try and read the next subtitle from the source.
int result = readSource(formatHolder, nextInputBuffer); int result = readSource(formatHolder, nextInputBuffer);
if (result == C.RESULT_BUFFER_READ) { if (result == C.RESULT_BUFFER_READ) {
// Clear BUFFER_FLAG_DECODE_ONLY (see [Internal: b/27893809]) and queue the buffer.
nextInputBuffer.clearFlag(C.BUFFER_FLAG_DECODE_ONLY);
if (nextInputBuffer.isEndOfStream()) { if (nextInputBuffer.isEndOfStream()) {
inputStreamEnded = true; inputStreamEnded = true;
} else { } else {
......
...@@ -75,7 +75,13 @@ import java.util.TreeSet; ...@@ -75,7 +75,13 @@ import java.util.TreeSet;
public void queueInputBuffer(SubtitleInputBuffer inputBuffer) throws SubtitleDecoderException { public void queueInputBuffer(SubtitleInputBuffer inputBuffer) throws SubtitleDecoderException {
Assertions.checkArgument(inputBuffer != null); Assertions.checkArgument(inputBuffer != null);
Assertions.checkArgument(inputBuffer == dequeuedInputBuffer); Assertions.checkArgument(inputBuffer == dequeuedInputBuffer);
if (inputBuffer.isDecodeOnly()) {
// We can drop this buffer early (i.e. before it would be decoded) as the CEA formats allow
// for decoding to begin mid-stream.
releaseInputBuffer(inputBuffer);
} else {
queuedInputBuffers.add(inputBuffer); queuedInputBuffers.add(inputBuffer);
}
dequeuedInputBuffer = null; dequeuedInputBuffer = null;
} }
......
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