From 01039b167118c6c86f50d6a0812241a9a057b75e Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Thu, 2 Dec 2010 19:44:41 +0100 Subject: [PATCH] gstdataqueue: Don't break ABI The order of the field was wrong, and the size of the structure didn't end up being the same. --- libs/gst/base/gstdataqueue.c | 20 ++++++++++---------- libs/gst/base/gstdataqueue.h | 10 +++++++--- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/libs/gst/base/gstdataqueue.c b/libs/gst/base/gstdataqueue.c index 69dadb4c0a..f6b11177cb 100644 --- a/libs/gst/base/gstdataqueue.c +++ b/libs/gst/base/gstdataqueue.c @@ -277,7 +277,7 @@ gst_data_queue_locked_flush (GstDataQueue * queue) gst_data_queue_cleanup (queue); STATUS (queue, "after flushing"); /* we deleted something... */ - if (queue->waiting_del) + if (queue->abidata.ABI.waiting_del) g_cond_signal (queue->item_del); } @@ -384,9 +384,9 @@ gst_data_queue_set_flushing (GstDataQueue * queue, gboolean flushing) queue->flushing = flushing; if (flushing) { /* release push/pop functions */ - if (queue->waiting_add) + if (queue->abidata.ABI.waiting_add) g_cond_signal (queue->item_add); - if (queue->waiting_del) + if (queue->abidata.ABI.waiting_del) g_cond_signal (queue->item_del); } GST_DATA_QUEUE_MUTEX_UNLOCK (queue); @@ -432,9 +432,9 @@ gst_data_queue_push (GstDataQueue * queue, GstDataQueueItem * item) /* signal might have removed some items */ while (gst_data_queue_locked_is_full (queue)) { - queue->waiting_del = TRUE; + queue->abidata.ABI.waiting_del = TRUE; g_cond_wait (queue->item_del, queue->qlock); - queue->waiting_del = FALSE; + queue->abidata.ABI.waiting_del = FALSE; if (queue->flushing) goto flushing; } @@ -448,7 +448,7 @@ gst_data_queue_push (GstDataQueue * queue, GstDataQueueItem * item) queue->cur_level.time += item->duration; STATUS (queue, "after pushing"); - if (queue->waiting_add) + if (queue->abidata.ABI.waiting_add) g_cond_signal (queue->item_add); GST_DATA_QUEUE_MUTEX_UNLOCK (queue); @@ -497,9 +497,9 @@ gst_data_queue_pop (GstDataQueue * queue, GstDataQueueItem ** item) GST_DATA_QUEUE_MUTEX_LOCK_CHECK (queue, flushing); while (gst_data_queue_locked_is_empty (queue)) { - queue->waiting_add = TRUE; + queue->abidata.ABI.waiting_add = TRUE; g_cond_wait (queue->item_add, queue->qlock); - queue->waiting_add = FALSE; + queue->abidata.ABI.waiting_add = FALSE; if (queue->flushing) goto flushing; } @@ -515,7 +515,7 @@ gst_data_queue_pop (GstDataQueue * queue, GstDataQueueItem ** item) queue->cur_level.time -= (*item)->duration; STATUS (queue, "after popping"); - if (queue->waiting_del) + if (queue->abidata.ABI.waiting_del) g_cond_signal (queue->item_del); GST_DATA_QUEUE_MUTEX_UNLOCK (queue); @@ -600,7 +600,7 @@ gst_data_queue_limits_changed (GstDataQueue * queue) g_return_if_fail (GST_IS_DATA_QUEUE (queue)); GST_DATA_QUEUE_MUTEX_LOCK (queue); - if (queue->waiting_del) { + if (queue->abidata.ABI.waiting_del) { GST_DEBUG ("signal del"); g_cond_signal (queue->item_del); } diff --git a/libs/gst/base/gstdataqueue.h b/libs/gst/base/gstdataqueue.h index d6cde4b3a1..d38230b527 100644 --- a/libs/gst/base/gstdataqueue.h +++ b/libs/gst/base/gstdataqueue.h @@ -128,16 +128,20 @@ struct _GstDataQueue gpointer *checkdata; GMutex *qlock; /* lock for queue (vs object lock) */ - gboolean waiting_add; GCond *item_add; /* signals buffers now available for reading */ - gboolean waiting_del; GCond *item_del; /* signals space now available for writing */ gboolean flushing; /* indicates whether conditions where signalled because * of external flushing */ GstDataQueueFullCallback fullcallback; GstDataQueueEmptyCallback emptycallback; - gpointer _gst_reserved[GST_PADDING - 4]; + union { + struct { + gboolean waiting_add; + gboolean waiting_del; + } ABI; + gpointer _gst_reserved[GST_PADDING - 2]; + } abidata; }; struct _GstDataQueueClass -- 2.34.1