diff options
author | John Stebbins <[email protected]> | 2016-09-26 10:31:07 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2016-09-26 10:31:07 -0700 |
commit | e2ec4209d76abdcaea3d4bfc587c2da7d3213da6 (patch) | |
tree | 602d376eb171240d9b0eed6202abfa4ab3f463d1 /libhb/sync.c | |
parent | ee6c82845747a17c0ed4ea267164a82bb59b8d48 (diff) |
sync: fix a hang with p-to-p end time
When a stream is finished, we need to see if there were any other
streams that were pending. The other streams could be blocking on a
condition variable and need to be unstuck.
Diffstat (limited to 'libhb/sync.c')
-rw-r--r-- | libhb/sync.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/libhb/sync.c b/libhb/sync.c index 03de14909..1f33db816 100644 --- a/libhb/sync.c +++ b/libhb/sync.c @@ -241,7 +241,9 @@ static int fillQueues( sync_common_t * common ) static void signalBuffer( sync_stream_t * stream ) { - if (hb_list_count(stream->in_queue) < stream->max_len) + if (hb_list_count(stream->in_queue) < stream->max_len || + stream->done || stream->common->job->done || + *stream->common->job->die) { hb_cond_signal(stream->cond_full); } @@ -1538,6 +1540,19 @@ static void OutputBuffer( sync_common_t * common ) } while (full); } +static void FlushBuffer( sync_common_t * common ) +{ + hb_lock(common->mutex); + + if (!common->found_first_pts) + { + checkFirstPts(common); + } + OutputBuffer(common); + + hb_unlock(common->mutex); +} + static void Synchronize( sync_stream_t * stream ) { sync_common_t * common = stream->common; @@ -2693,6 +2708,7 @@ static int syncVideoWork( hb_work_object_t * w, hb_buffer_t ** buf_in, if (pv->stream->done) { + FlushBuffer(pv->stream->common); return HB_WORK_DONE; } if (in->s.flags & HB_BUF_FLAG_EOF) @@ -2717,6 +2733,7 @@ static int syncVideoWork( hb_work_object_t * w, hb_buffer_t ** buf_in, if (pv->stream->done) { + FlushBuffer(pv->stream->common); return HB_WORK_DONE; } return HB_WORK_OK; @@ -2783,6 +2800,7 @@ static int syncAudioWork( hb_work_object_t * w, hb_buffer_t ** buf_in, if (pv->stream->done) { + FlushBuffer(pv->stream->common); return HB_WORK_DONE; } if (in->s.flags & HB_BUF_FLAG_EOF) @@ -2798,6 +2816,7 @@ static int syncAudioWork( hb_work_object_t * w, hb_buffer_t ** buf_in, if (pv->stream->done) { + FlushBuffer(pv->stream->common); return HB_WORK_DONE; } return HB_WORK_OK; @@ -3091,6 +3110,7 @@ static int syncSubtitleWork( hb_work_object_t * w, hb_buffer_t ** buf_in, if (pv->stream->done) { + FlushBuffer(pv->stream->common); return HB_WORK_DONE; } if (in->s.flags & HB_BUF_FLAG_EOF) @@ -3115,6 +3135,7 @@ static int syncSubtitleWork( hb_work_object_t * w, hb_buffer_t ** buf_in, if (pv->stream->done) { + FlushBuffer(pv->stream->common); return HB_WORK_DONE; } return HB_WORK_OK; |