diff options
author | John Stebbins <[email protected]> | 2016-05-19 13:42:26 -0600 |
---|---|---|
committer | John Stebbins <[email protected]> | 2016-05-19 13:42:26 -0600 |
commit | e2bd6cc4b01fee16dcc52d193494e640ab16c496 (patch) | |
tree | f40741b1158cc58c5578a996f8ef41fa1ec85c82 | |
parent | dec17f28756ae8aa85cdf1be5e33d26d7fe44870 (diff) |
sync: detect and drop 0 duration initial video frame
-rw-r--r-- | libhb/sync.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/libhb/sync.c b/libhb/sync.c index 659c5b669..689dd21a0 100644 --- a/libhb/sync.c +++ b/libhb/sync.c @@ -470,12 +470,6 @@ static void fixVideoOverlap( sync_stream_t * stream ) int64_t overlap; hb_buffer_t * buf; - if (!stream->first_frame) - { - // There are no overlaps if we haven't seen the first frame yet. - return; - } - // If time goes backwards drop the frame. // Check if subsequent buffers also overlap. while ((buf = hb_list_item(stream->in_queue, 0)) != NULL) @@ -765,12 +759,23 @@ static void streamFlush( sync_stream_t * stream ) while (hb_list_count(stream->in_queue) > 0) { + hb_buffer_t * buf; + if (!stream->common->found_first_pts) { checkFirstPts(stream->common); } + if (stream->next_pts == (int64_t)AV_NOPTS_VALUE) + { + // Initialize next_pts, it is used to make timestamp corrections + buf = hb_list_item(stream->in_queue, 0); + if (buf != NULL) + { + stream->next_pts = buf->s.start; + } + } fixStreamTimestamps(stream); - hb_buffer_t * buf = hb_list_item(stream->in_queue, 0); + buf = hb_list_item(stream->in_queue, 0); if (buf != NULL) { hb_list_rem(stream->in_queue, buf); |