summaryrefslogtreecommitdiffstats
path: root/libhb/fifo.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2015-04-22 21:11:30 +0000
committerjstebbins <[email protected]>2015-04-22 21:11:30 +0000
commitc48e55d5563dc05aed1652a34bc5359376aed2a7 (patch)
treef693e6ec79680b9cbd6e6e0101ec110804ca9cd4 /libhb/fifo.c
parentd839ca1690e89704f2b4a8e7d5ab40f8b7cb6a83 (diff)
sync: fix frame p-to-p extra audio after end frame
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7119 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/fifo.c')
-rw-r--r--libhb/fifo.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libhb/fifo.c b/libhb/fifo.c
index 3be686500..f88c43bfb 100644
--- a/libhb/fifo.c
+++ b/libhb/fifo.c
@@ -26,6 +26,7 @@ struct hb_fifo_s
int wait_full;
hb_cond_t * cond_empty;
int wait_empty;
+ hb_cond_t * cond_alert_full;
uint32_t capacity;
uint32_t thresh;
uint32_t size;
@@ -864,6 +865,11 @@ hb_fifo_t * hb_fifo_init( int capacity, int thresh )
return f;
}
+void hb_fifo_register_full_cond( hb_fifo_t * f, hb_cond_t * c )
+{
+ f->cond_alert_full = c;
+}
+
int hb_fifo_size_bytes( hb_fifo_t * f )
{
int ret = 0;
@@ -1055,6 +1061,8 @@ void hb_fifo_push_wait( hb_fifo_t * f, hb_buffer_t * b )
if( f->size >= f->capacity )
{
f->wait_full = 1;
+ if (f->cond_alert_full != NULL)
+ hb_cond_broadcast( f->cond_alert_full );
hb_cond_timedwait( f->cond_full, f->lock, FIFO_TIMEOUT );
}
if( f->size > 0 )
@@ -1089,6 +1097,11 @@ void hb_fifo_push( hb_fifo_t * f, hb_buffer_t * b )
}
hb_lock( f->lock );
+ if (f->size >= f->capacity &&
+ f->cond_alert_full != NULL)
+ {
+ hb_cond_broadcast( f->cond_alert_full );
+ }
if( f->size > 0 )
{
f->last->next = b;
@@ -1124,6 +1137,11 @@ void hb_fifo_push_head( hb_fifo_t * f, hb_buffer_t * b )
}
hb_lock( f->lock );
+ if (f->size >= f->capacity &&
+ f->cond_alert_full != NULL)
+ {
+ hb_cond_broadcast( f->cond_alert_full );
+ }
/*
* If there are a chain of buffers prepend the lot