- Widen the DTS-to-PCR acceptance window from +-5sec to +-5min since there's nothing in the standard that bounds the offset between a DTS and its clock reference.
git-svn-id: svn://localhost/HandBrake/trunk@1802
b64f7644-9d1e-0410-96f1-
a4d463321fa5
int video_id; /* demuxer stream id for video */
int video_codec; /* worker object id of video codec */
int video_codec_param; /* codec specific config */
-
+ int flaky_clock; /* can lose reference clock */
+ /* (for over-the-air transport streams) */
const char *video_codec_name;
int video_bitrate;
const char *container_name;
{
dts = pts;
}
- if ( state )
+ if ( state && state->flaky_clock )
{
// Program streams have an SCR in every PACK header so they
// can't lose their clock reference. But the PCR in Transport
// timestamps against the current reference clock and discarding
// packets where the DTS is "too far" from its clock.
int64_t fdelta = dts - state->last_scr;
- if ( fdelta < -5000 * 90 || fdelta > 5000 * 90 )
+ if ( fdelta < -300 * 90000LL || fdelta > 300 * 90000LL )
{
// packet too far behind or ahead of its clock reference
+ ++state->dts_drops;
pos = pes_packet_end;
continue;
}
typedef struct {
int64_t last_scr; /* unadjusted SCR from most recent pack */
int scr_changes; /* number of SCR discontinuities */
+ int flaky_clock; /* try to compensate for PCR drops */
+ int dts_drops; /* number of drops because DTS too far from SCR */
} hb_psdemux_t;
int hb_demux_ps( hb_buffer_t * ps_buf, hb_list_t * es_list, hb_psdemux_t * );
list = hb_list_init();
hb_buffer_t *ps = hb_buffer_init( HB_DVD_READ_BUFFER_SIZE );
+ r->demux.flaky_clock = r->title->flaky_clock;
while( !*r->die && !r->job->done )
{
}
hb_log( "reader: done. %d scr changes", r->demux.scr_changes );
+ if ( r->demux.dts_drops )
+ {
+ hb_log( "reader: %d drops because DTS out of range", r->demux.dts_drops );
+ }
free( r );
_r = NULL;
d->ts_buf[i] = malloc( HB_DVD_READ_BUFFER_SIZE );
}
hb_stream_seek( d, 0. );
+
+ if ( d->packetsize == 188 )
+ {
+ // Assume that an over-the-air transport stream can lose PCR
+ // packets and try to filter out the timing inconsistencies.
+ title->flaky_clock = 1;
+ }
}
return d;
}