Commit afebd60e by aquilescanta Committed by Oliver Woodman

Do not seek to the start of live Transport Streams after preparation

Issue:#4666

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=209742008
parent bcc69efc
...@@ -243,8 +243,8 @@ public final class TsExtractor implements Extractor { ...@@ -243,8 +243,8 @@ public final class TsExtractor implements Extractor {
@Override @Override
public @ReadResult int read(ExtractorInput input, PositionHolder seekPosition) public @ReadResult int read(ExtractorInput input, PositionHolder seekPosition)
throws IOException, InterruptedException { throws IOException, InterruptedException {
long inputLength = input.getLength();
if (tracksEnded) { if (tracksEnded) {
long inputLength = input.getLength();
boolean canReadDuration = inputLength != C.LENGTH_UNSET && mode != MODE_HLS; boolean canReadDuration = inputLength != C.LENGTH_UNSET && mode != MODE_HLS;
if (canReadDuration && !durationReader.isDurationReadFinished()) { if (canReadDuration && !durationReader.isDurationReadFinished()) {
return durationReader.readDuration(input, seekPosition, pcrPid); return durationReader.readDuration(input, seekPosition, pcrPid);
...@@ -324,10 +324,10 @@ public final class TsExtractor implements Extractor { ...@@ -324,10 +324,10 @@ public final class TsExtractor implements Extractor {
payloadReader.consume(tsPacketBuffer, payloadUnitStartIndicator); payloadReader.consume(tsPacketBuffer, payloadUnitStartIndicator);
tsPacketBuffer.setLimit(limit); tsPacketBuffer.setLimit(limit);
} }
if (mode != MODE_HLS && !wereTracksEnded && tracksEnded) { if (mode != MODE_HLS && !wereTracksEnded && tracksEnded && inputLength != C.LENGTH_UNSET) {
// We have read all tracks from all PMTs in this stream. Now seek to the beginning and read // We have read all tracks from all PMTs in this non-live stream. Now seek to the beginning
// again to make sure we output all media, including any contained in packets prior to those // and read again to make sure we output all media, including any contained in packets prior
// containing the track information. // to those containing the track information.
pendingSeekToStart = true; pendingSeekToStart = true;
} }
......
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