diff options
author | jstebbins <[email protected]> | 2013-01-06 01:20:14 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2013-01-06 01:20:14 +0000 |
commit | a218b9550cca202a57733d28159508a1d014a12a (patch) | |
tree | 0aa6e46ee2ce9f6e7fea595966de9004ffab7715 | |
parent | c21c7152558140154fc16bb6cad06bcdf4ffce81 (diff) |
libhb: handle incorrect stuffing in transport streams
Incorrectly formatted stuffing causes invalid PCRs which results in sync
issues.
I've only seen this in one poorly authored BD, but it's easy to handle.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5152 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | libhb/stream.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libhb/stream.c b/libhb/stream.c index a7034042d..2710c94f2 100644 --- a/libhb/stream.c +++ b/libhb/stream.c @@ -4769,7 +4769,13 @@ hb_buffer_t * hb_ts_decode_pkt( hb_stream_t *stream, const uint8_t * pkt ) } // if there's an adaptation header & PCR_flag is set // get the PCR (Program Clock Reference) - if ( adapt_len > 7 && ( pkt[5] & 0x10 ) != 0 ) + // + // JAS: I have a badly mastered BD that does adaptation field + // stuffing incorrectly which results in invalid PCRs. Test + // for all 0xff to guard against this. + if ( adapt_len > 7 && ( pkt[5] & 0x10 ) != 0 && + !(pkt[5] == 0xff && pkt[6] == 0xff && pkt[7] == 0xff && + pkt[8] == 0xff && pkt[9] == 0xff && pkt[10] == 0xff)) { int64_t pcr; pcr = ( (uint64_t)pkt[6] << (33 - 8) ) | |