summaryrefslogtreecommitdiffstats
path: root/libhb/demuxmpeg.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2015-04-22 21:59:31 +0000
committerjstebbins <[email protected]>2015-04-22 21:59:31 +0000
commitecb77662da768b8011be27c68725eea10c62c570 (patch)
treedcd9fd8859ae8986d173ddcc6fe644c9e9782042 /libhb/demuxmpeg.c
parentddcecd907b532f867a5c7a1aa89ea6909205caab (diff)
demuxmpeg: Don't drop frames with bad timestamps
Just invalidate the timestamps and let the decoders interpolate. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7121 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/demuxmpeg.c')
-rw-r--r--libhb/demuxmpeg.c53
1 files changed, 22 insertions, 31 deletions
diff --git a/libhb/demuxmpeg.c b/libhb/demuxmpeg.c
index 32e0d6387..f370caf04 100644
--- a/libhb/demuxmpeg.c
+++ b/libhb/demuxmpeg.c
@@ -283,6 +283,25 @@ void hb_demux_mpeg(hb_buffer_t *buf, hb_list_t *list_es,
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
@@ -299,13 +318,9 @@ void hb_demux_mpeg(hb_buffer_t *buf, hb_list_t *list_es,
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
{
@@ -315,31 +330,7 @@ void hb_demux_mpeg(hb_buffer_t *buf, hb_list_t *list_es,
// 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;
}
}