diff options
author | jstebbins <[email protected]> | 2011-06-21 09:41:20 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2011-06-21 09:41:20 +0000 |
commit | 3a4c8868d3ad56b0fba7012364b882bd19b1bf1a (patch) | |
tree | f922d60e2d98a775239bc4468244f3ac2b3cd819 /libhb | |
parent | 8a6a5924fa4f2323c07cdf4f7d1aa693e6c93b2a (diff) |
libhb: flush frame re-ordering delay queue properly when there are < 8 frames
If the queue never completely filled, it would not be flushed.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4070 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/decavcodec.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c index 63b1c6dff..87e829a75 100644 --- a/libhb/decavcodec.c +++ b/libhb/decavcodec.c @@ -107,6 +107,7 @@ struct hb_work_private_s uint32_t decode_errors; int brokenByMicrosoft; // video stream may contain packed b-frames hb_buffer_t* delayq[HEAP_SIZE]; + int queue_primed; pts_heap_t pts_heap; void* buffer; struct SwsContext *sws_context; // if we have to rescale or convert color space @@ -665,7 +666,7 @@ static void log_chapter( hb_work_private_t *pv, int chap_num, int64_t pts ) static void flushDelayQueue( hb_work_private_t *pv ) { hb_buffer_t *buf; - int slot = pv->nframes & (HEAP_SIZE-1); + int slot = pv->queue_primed ? pv->nframes & (HEAP_SIZE-1) : 0; // flush all the video packets left on our timestamp-reordering delay q while ( ( buf = pv->delayq[slot] ) != NULL ) @@ -906,6 +907,7 @@ static int decodeFrame( hb_work_private_t *pv, uint8_t *data, int size, int sequ int slot = pv->nframes & (HEAP_SIZE-1); if ( ( buf = pv->delayq[slot] ) != NULL ) { + pv->queue_primed = 1; buf->start = heap_pop( &pv->pts_heap ); if ( pv->new_chap && buf->start >= pv->chap_time ) |