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

Report only 1 FRAG_PARSING_ERROR per parsed TS file #4481

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/demux/tsdemuxer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ class TSDemuxer implements Demuxer {
}

// loop through TS packets
let tsPacketErrors = 0;
for (let start = syncOffset; start < len; start += 188) {
if (data[start] === 0x47) {
const stt = !!(data[start + 1] & 0x40);
Expand Down Expand Up @@ -391,15 +392,19 @@ class TSDemuxer implements Demuxer {
break;
}
} else {
this.observer.emit(Events.ERROR, Events.ERROR, {
type: ErrorTypes.MEDIA_ERROR,
details: ErrorDetails.FRAG_PARSING_ERROR,
fatal: false,
reason: 'TS packet did not start with 0x47',
});
tsPacketErrors++;
}
}

if (tsPacketErrors > 0) {
this.observer.emit(Events.ERROR, Events.ERROR, {
type: ErrorTypes.MEDIA_ERROR,
details: ErrorDetails.FRAG_PARSING_ERROR,
fatal: false,
reason: `Found ${tsPacketErrors} TS packet/s that do not start with 0x47`,
});
}

avcTrack.pesData = avcData;
audioTrack.pesData = audioData;
id3Track.pesData = id3Data;
Expand Down