if ( buf->s.start >= 0 )
{
int64_t fdelta;
+ if (buf->s.type == AUDIO_BUF || buf->s.type == VIDEO_BUF)
+ {
+ if ( state->last_pts >= 0 )
+ {
+ fdelta = buf->s.start - state->last_pts;
+ if ( fdelta < -5 * 90000LL || fdelta > 5 * 90000LL )
+ {
+ // Packet too far from last. This may be a NZ TV
+ // broadcast as they like to change the PCR without
+ // sending a PCR update. Since it may be a while
+ // until they actually tell us the new PCR use the
+ // PTS as the PCR.
+ ++state->scr_changes;
+ state->last_scr = buf->s.start;
+ state->scr_delta = 0;
+ }
+ }
+ state->last_pts = buf->s.start;
+ }
if (state->last_scr != AV_NOPTS_VALUE)
{
// Program streams have an SCR in every PACK header so they
if ( fdelta < -300 * 90000LL || fdelta > 300 * 90000LL )
{
// packet too far behind or ahead of its clock reference
- ++state->dts_drops;
- ++state->dts_drop_run;
- hb_buffer_t *tmp = buf->next;
- buf->next = NULL;
- hb_buffer_close( &buf );
- buf = tmp;
- continue;
+ buf->s.renderOffset = AV_NOPTS_VALUE;
+ buf->s.start = AV_NOPTS_VALUE;
+ buf->s.stop = AV_NOPTS_VALUE;
}
else
{
// our scr_delta with each valid timestamp so that
// fdelta does not continually grow.
state->scr_delta = buf->s.start - state->last_scr;
- if (state->dts_drop_run > 0)
- {
- hb_error("Packet clock reference error. Dropped %d frames.", state->dts_drop_run);
- state->dts_drop_run = 0;
- }
- }
- }
- if (buf->s.type == AUDIO_BUF || buf->s.type == VIDEO_BUF)
- {
- if ( state->last_pts >= 0 )
- {
- fdelta = buf->s.start - state->last_pts;
- if ( fdelta < -5 * 90000LL || fdelta > 5 * 90000LL )
- {
- // Packet too far from last. This may be a NZ TV
- // broadcast as they like to change the PCR without
- // sending a PCR update. Since it may be a while
- // until they actually tell us the new PCR use the
- // PTS as the PCR.
- ++state->scr_changes;
- state->last_scr = buf->s.start;
- state->scr_delta = 0;
- }
}
- state->last_pts = buf->s.start;
}
}