Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TS Extractor: Fix problem with locating first PCR in HD-PVR recordings #7988

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
*/
/* package */ final class TsDurationReader {

private static final int TIMESTAMP_SEARCH_BYTES = 600 * TsExtractor.TS_PACKET_SIZE;
private static final int TIMESTAMP_SEARCH_BYTES_START = 1200 * TsExtractor.TS_PACKET_SIZE;
private static final int TIMESTAMP_SEARCH_BYTES_END = 600 * TsExtractor.TS_PACKET_SIZE;

private final TimestampAdjuster pcrTimestampAdjuster;
private final ParsableByteArray packetBuffer;
Expand Down Expand Up @@ -125,7 +126,7 @@ private int finishReadDuration(ExtractorInput input) {

private int readFirstPcrValue(ExtractorInput input, PositionHolder seekPositionHolder, int pcrPid)
throws IOException {
int bytesToSearch = (int) min(TIMESTAMP_SEARCH_BYTES, input.getLength());
int bytesToSearch = (int) min(TIMESTAMP_SEARCH_BYTES_START, input.getLength());
int searchStartPosition = 0;
if (input.getPosition() != searchStartPosition) {
seekPositionHolder.position = searchStartPosition;
Expand Down Expand Up @@ -161,7 +162,7 @@ private long readFirstPcrValueFromBuffer(ParsableByteArray packetBuffer, int pcr
private int readLastPcrValue(ExtractorInput input, PositionHolder seekPositionHolder, int pcrPid)
throws IOException {
long inputLength = input.getLength();
int bytesToSearch = (int) min(TIMESTAMP_SEARCH_BYTES, inputLength);
int bytesToSearch = (int) min(TIMESTAMP_SEARCH_BYTES_END, inputLength);
long searchStartPosition = inputLength - bytesToSearch;
if (input.getPosition() != searchStartPosition) {
seekPositionHolder.position = searchStartPosition;
Expand Down