diff options
author | John Stebbins <[email protected]> | 2018-01-25 14:46:56 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2018-01-25 14:47:25 -0700 |
commit | 2a011d1d9bd2726aee48aa44a3b99f86a2460cf9 (patch) | |
tree | 18958236950382d151400c7ab70bcaa439ee52c3 /libhb/sync.c | |
parent | b67f023ed5504b96d42ee7155f89d9dd805d952c (diff) |
sync: fix hang in searching for PtoP start frame
fixes https://forum.handbrake.fr/viewtopic.php?f=11&t=37311
Diffstat (limited to 'libhb/sync.c')
-rw-r--r-- | libhb/sync.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/libhb/sync.c b/libhb/sync.c index 3b1f6d183..c15d54a2e 100644 --- a/libhb/sync.c +++ b/libhb/sync.c @@ -1499,22 +1499,22 @@ static void OutputBuffer( sync_common_t * common ) for (ii = 0; ii < common->stream_count; ii++) { sync_stream_t * stream = &common->streams[ii]; + int min = stream->min_len; + + // Ignore minimum buffer requirements for video if we have + // not yet found the PtoP start frame. + if (!common->start_found && common->wait_for_frame && + stream->type == SYNC_TYPE_VIDEO) + { + min = 0; + } // We need at least 2 buffers in the queue in order to fix // frame overlaps and inter-frame gaps. So if a queue is // low, do not do normal PTS interleaving with this queue. // Except for subtitles which are not processed for gaps // and overlaps. - if (hb_list_count(stream->in_queue) > stream->min_len) + if (hb_list_count(stream->in_queue) > min) { - if (!common->start_found) - { - // If we have not yet found the start point for - // p-to-p, grab the first stream that has data - // above min_len. This ensures that we prefer - // video buffers for finding start point. - out_stream = stream; - break; - } buf = hb_list_item(stream->in_queue, 0); if (buf->s.start < pts) { @@ -1567,8 +1567,18 @@ static void OutputBuffer( sync_common_t * common ) { // pts_to_start or frame_to_start were specified. // Wait for the appropriate start point. - if (common->wait_for_frame && out_stream->type == SYNC_TYPE_VIDEO) + if (common->wait_for_frame) { + if (out_stream->type != SYNC_TYPE_VIDEO) + { + // We haven't found the PtoP start frame yet and + // this buffer is either before the start frame or + // the video queue was empty. + out_stream->next_pts = buf->s.start + buf->s.duration; + hb_list_rem(out_stream->in_queue, buf); + hb_buffer_close(&buf); + continue; + } common->start_pts = buf->s.start + 1; if (out_stream->frame_count >= common->job->frame_to_start) { |