summaryrefslogtreecommitdiffstats
path: root/libhb/sync.c
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2016-06-10 10:58:53 -0600
committerJohn Stebbins <[email protected]>2016-06-10 11:15:09 -0600
commit662b000b75137896d5139017f53c93746474b5eb (patch)
tree219caa52d2355baf34828f246e58a04833521859 /libhb/sync.c
parentf4f3e9c40299e63adae24a5b85316f0771739c9b (diff)
sync: fix potential stall when searching for p-to-p start
A full input queue could cause the search to stall
Diffstat (limited to 'libhb/sync.c')
-rw-r--r--libhb/sync.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/libhb/sync.c b/libhb/sync.c
index 6f33e978a..6cd30f5e9 100644
--- a/libhb/sync.c
+++ b/libhb/sync.c
@@ -1491,7 +1491,7 @@ static void Synchronize( sync_stream_t * stream )
// blocking when output fifos become full. Wait here before
// performing any output when the output fifo for the input stream
// is full
- if (stream->fifo_out != NULL)
+ if (stream->fifo_out != NULL && common->start_found)
{
while (!common->job->done && !*common->job->die)
{
@@ -1791,7 +1791,16 @@ static void QueueBuffer( sync_stream_t * stream, hb_buffer_t * buf )
while (hb_list_count(stream->in_queue) > stream->max_len)
{
- hb_cond_wait(stream->cond_full, stream->common->mutex);
+ if (!stream->common->start_found)
+ {
+ hb_unlock(stream->common->mutex);
+ Synchronize(stream);
+ hb_lock(stream->common->mutex);
+ }
+ else
+ {
+ hb_cond_wait(stream->cond_full, stream->common->mutex);
+ }
}
// Render offset is only useful for decoders, which are all