mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
- return boolean in _interrupt to better inform element
Original commit message from CVS: - return boolean in _interrupt to better inform element - fix default bufferpool unref
This commit is contained in:
parent
560beb6b94
commit
89bf2733e9
6 changed files with 32 additions and 12 deletions
|
@ -151,8 +151,16 @@ _gst_buffer_pool_default_free (GstData *data)
|
|||
GstBufferPool *pool = (GstBufferPool*) data;
|
||||
GstBufferPoolDefault *def = (GstBufferPoolDefault*) pool->user_data;
|
||||
GstMemChunk *data_chunk = def->mem_chunk;
|
||||
guint real_buffer_size;
|
||||
|
||||
GST_DEBUG (GST_CAT_BUFFER, "destroying default buffer pool %p", pool);
|
||||
real_buffer_size = (((def->size-1) / 32) + 1) * 32;
|
||||
|
||||
GST_DEBUG (GST_CAT_BUFFER,"destroying default buffer pool %p bytes:%d size:%d",
|
||||
pool, real_buffer_size, def->size);
|
||||
|
||||
g_mutex_lock (_default_pool_lock);
|
||||
g_hash_table_remove (_default_pools, GINT_TO_POINTER (real_buffer_size));
|
||||
g_mutex_unlock (_default_pool_lock);
|
||||
|
||||
/* this is broken right now, FIXME
|
||||
gst_mem_chunk_destroy (data_chunk); */
|
||||
|
|
|
@ -2579,7 +2579,7 @@ gst_element_interrupt (GstElement *element)
|
|||
return gst_scheduler_interrupt (GST_ELEMENT_SCHED (element), element);
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -464,19 +464,24 @@ gst_scheduler_error (GstScheduler *sched, GstElement *element)
|
|||
* @element: the element requesting a yield
|
||||
*
|
||||
* Tell the scheduler to schedule another element.
|
||||
*
|
||||
* Returns: TRUE if the element should save its state, FALSE
|
||||
* if the scheduler can perform this action itself.
|
||||
*/
|
||||
void
|
||||
gboolean
|
||||
gst_scheduler_yield (GstScheduler *sched, GstElement *element)
|
||||
{
|
||||
GstSchedulerClass *sclass;
|
||||
|
||||
g_return_if_fail (GST_IS_SCHEDULER (sched));
|
||||
g_return_if_fail (GST_IS_ELEMENT (element));
|
||||
g_return_val_if_fail (GST_IS_SCHEDULER (sched), TRUE);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (element), TRUE);
|
||||
|
||||
sclass = GST_SCHEDULER_GET_CLASS (sched);
|
||||
|
||||
if (sclass->yield)
|
||||
sclass->yield (sched, element);
|
||||
return sclass->yield (sched, element);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -89,7 +89,7 @@ struct _GstSchedulerClass {
|
|||
void (*scheduling_change) (GstScheduler *sched, GstElement *element);
|
||||
void (*lock_element) (GstScheduler *sched, GstElement *element);
|
||||
void (*unlock_element) (GstScheduler *sched, GstElement *element);
|
||||
void (*yield) (GstScheduler *sched, GstElement *element);
|
||||
gboolean (*yield) (GstScheduler *sched, GstElement *element);
|
||||
gboolean (*interrupt) (GstScheduler *sched, GstElement *element);
|
||||
void (*error) (GstScheduler *sched, GstElement *element);
|
||||
void (*pad_link) (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad);
|
||||
|
@ -123,7 +123,7 @@ GstElementStateReturn gst_scheduler_state_transition (GstScheduler *sched, GstEl
|
|||
void gst_scheduler_scheduling_change (GstScheduler *sched, GstElement *element);
|
||||
void gst_scheduler_lock_element (GstScheduler *sched, GstElement *element);
|
||||
void gst_scheduler_unlock_element (GstScheduler *sched, GstElement *element);
|
||||
void gst_scheduler_yield (GstScheduler *sched, GstElement *element);
|
||||
gboolean gst_scheduler_yield (GstScheduler *sched, GstElement *element);
|
||||
gboolean gst_scheduler_interrupt (GstScheduler *sched, GstElement *element);
|
||||
void gst_scheduler_error (GstScheduler *sched, GstElement *element);
|
||||
void gst_scheduler_pad_link (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad);
|
||||
|
|
|
@ -116,7 +116,7 @@ static GstElementStateReturn
|
|||
gst_basic_scheduler_state_transition (GstScheduler *sched, GstElement *element, gint transition);
|
||||
static void gst_basic_scheduler_lock_element (GstScheduler *sched, GstElement *element);
|
||||
static void gst_basic_scheduler_unlock_element (GstScheduler *sched, GstElement *element);
|
||||
static void gst_basic_scheduler_yield (GstScheduler *sched, GstElement *element);
|
||||
static gboolean gst_basic_scheduler_yield (GstScheduler *sched, GstElement *element);
|
||||
static gboolean gst_basic_scheduler_interrupt (GstScheduler *sched, GstElement *element);
|
||||
static void gst_basic_scheduler_error (GstScheduler *sched, GstElement *element);
|
||||
static void gst_basic_scheduler_pad_link (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad);
|
||||
|
@ -1118,7 +1118,7 @@ gst_basic_scheduler_unlock_element (GstScheduler * sched, GstElement * element)
|
|||
do_cothread_unlock (GST_ELEMENT_THREADSTATE (element));
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
gst_basic_scheduler_yield (GstScheduler *sched, GstElement *element)
|
||||
{
|
||||
if (GST_ELEMENT_IS_COTHREAD_STOPPING (element)) {
|
||||
|
@ -1127,6 +1127,7 @@ gst_basic_scheduler_yield (GstScheduler *sched, GstElement *element)
|
|||
|
||||
/* no need to do a pre_run, the cothread is stopping */
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -202,7 +202,7 @@ static GstElementStateReturn
|
|||
static void gst_opt_scheduler_scheduling_change (GstScheduler *sched, GstElement *element);
|
||||
static void gst_opt_scheduler_lock_element (GstScheduler *sched, GstElement *element);
|
||||
static void gst_opt_scheduler_unlock_element (GstScheduler *sched, GstElement *element);
|
||||
static void gst_opt_scheduler_yield (GstScheduler *sched, GstElement *element);
|
||||
static gboolean gst_opt_scheduler_yield (GstScheduler *sched, GstElement *element);
|
||||
static gboolean gst_opt_scheduler_interrupt (GstScheduler *sched, GstElement *element);
|
||||
static void gst_opt_scheduler_error (GstScheduler *sched, GstElement *element);
|
||||
static void gst_opt_scheduler_pad_link (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad);
|
||||
|
@ -1214,7 +1214,7 @@ gst_opt_scheduler_unlock_element (GstScheduler *sched, GstElement *element)
|
|||
g_warning ("unlock element, implement me");
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
gst_opt_scheduler_yield (GstScheduler *sched, GstElement *element)
|
||||
{
|
||||
#ifdef USE_COTHREADS
|
||||
|
@ -1224,6 +1224,12 @@ gst_opt_scheduler_yield (GstScheduler *sched, GstElement *element)
|
|||
get_group (element, &group);
|
||||
if (group && group->entry == element)
|
||||
do_cothread_switch (do_cothread_get_main (((GstOptScheduler*)sched)->context));
|
||||
|
||||
return FALSE;
|
||||
#else
|
||||
g_warning ("element %s performs a yield, please fix the element",
|
||||
GST_ELEMENT_NAME (element));
|
||||
return TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue