mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
Added an extra signal_cond to queue to make sure that the waiting thread is woken up. Can somebody with queue problem...
Original commit message from CVS: Added an extra signal_cond to queue to make sure that the waiting thread is woken up. Can somebody with queue problems verifify that this does improve the situation a bit. I'm suspecting that something else is going on, like a pthreads bug or something. Small updates to the fake elements.
This commit is contained in:
parent
11670c033d
commit
73ae4b1bce
10 changed files with 80 additions and 44 deletions
|
@ -181,7 +181,7 @@ gst_fakesink_chain (GstPad *pad, GstBuffer *buf)
|
|||
g_return_if_fail (buf != NULL);
|
||||
|
||||
fakesink = GST_FAKESINK (pad->parent);
|
||||
g_print("(%s:%s)< ",GST_DEBUG_PAD_NAME(pad));
|
||||
g_print("fakesink: ******* (%s:%s)< \n",GST_DEBUG_PAD_NAME(pad));
|
||||
|
||||
gst_buffer_unref (buf);
|
||||
|
||||
|
|
|
@ -29,7 +29,8 @@ GstElementDetails gst_fakesrc_details = {
|
|||
"Source",
|
||||
"Push empty (no data) buffers around",
|
||||
VERSION,
|
||||
"Erik Walthinsen <omega@cse.ogi.edu>",
|
||||
"Erik Walthinsen <omega@cse.ogi.edu>\n"
|
||||
"Wim Taymans <wim.taymans@chello.be>"
|
||||
"(C) 1999",
|
||||
};
|
||||
|
||||
|
@ -46,7 +47,7 @@ enum {
|
|||
ARG_NUM_SOURCES,
|
||||
ARG_LOOP_BASED,
|
||||
ARG_OUTPUT,
|
||||
ARG_PATERN,
|
||||
ARG_PATTERN,
|
||||
ARG_NUM_BUFFERS,
|
||||
};
|
||||
|
||||
|
@ -60,8 +61,8 @@ gst_fakesrc_output_get_type(void) {
|
|||
{ FAKESRC_PING_PONG, "3", "Ping-Pong"},
|
||||
{ FAKESRC_ORDERED_RANDOM, "4", "Ordered Random"},
|
||||
{ FAKESRC_RANDOM, "5", "Random"},
|
||||
{ FAKESRC_PATERN_LOOP, "6", "Patern loop"},
|
||||
{ FAKESRC_PING_PONG_PATERN, "7", "Ping-Pong Patern"},
|
||||
{ FAKESRC_PATTERN_LOOP, "6", "Patttern loop"},
|
||||
{ FAKESRC_PING_PONG_PATTERN, "7", "Ping-Pong Pattern"},
|
||||
{ FAKESRC_GET_ALWAYS_SUCEEDS, "8", "'_get' Always succeeds"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
@ -119,8 +120,8 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
|
|||
GTK_ARG_READWRITE, ARG_LOOP_BASED);
|
||||
gtk_object_add_arg_type ("GstFakeSrc::output", GST_TYPE_FAKESRC_OUTPUT,
|
||||
GTK_ARG_READWRITE, ARG_OUTPUT);
|
||||
gtk_object_add_arg_type ("GstFakeSrc::patern", GTK_TYPE_STRING,
|
||||
GTK_ARG_READWRITE, ARG_PATERN);
|
||||
gtk_object_add_arg_type ("GstFakeSrc::pattern", GTK_TYPE_STRING,
|
||||
GTK_ARG_READWRITE, ARG_PATTERN);
|
||||
gtk_object_add_arg_type ("GstFakeSrc::num_buffers", GTK_TYPE_INT,
|
||||
GTK_ARG_READWRITE, ARG_NUM_BUFFERS);
|
||||
|
||||
|
@ -146,11 +147,16 @@ gst_fakesrc_init (GstFakeSrc *fakesrc)
|
|||
|
||||
// create our first output pad
|
||||
pad = gst_pad_new("src",GST_PAD_SRC);
|
||||
gst_pad_set_get_function(pad,gst_fakesrc_get);
|
||||
gst_element_add_pad(GST_ELEMENT(fakesrc),pad);
|
||||
fakesrc->srcpads = g_slist_append(NULL,pad);
|
||||
|
||||
fakesrc->loop_based = FALSE;
|
||||
fakesrc->loop_based = TRUE;
|
||||
|
||||
if (fakesrc->loop_based)
|
||||
gst_element_set_loop_function (GST_ELEMENT (fakesrc), gst_fakesrc_loop);
|
||||
else
|
||||
gst_pad_set_get_function(pad,gst_fakesrc_get);
|
||||
|
||||
fakesrc->num_buffers = -1;
|
||||
// we're ready right away, since we don't have any args...
|
||||
// gst_element_set_state(GST_ELEMENT(fakesrc),GST_STATE_READY);
|
||||
|
@ -206,7 +212,7 @@ gst_fakesrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
|||
break;
|
||||
case ARG_OUTPUT:
|
||||
break;
|
||||
case ARG_PATERN:
|
||||
case ARG_PATTERN:
|
||||
break;
|
||||
case ARG_NUM_BUFFERS:
|
||||
src->num_buffers = GTK_VALUE_INT (*arg);
|
||||
|
@ -236,8 +242,8 @@ gst_fakesrc_get_arg (GtkObject *object, GtkArg *arg, guint id)
|
|||
case ARG_OUTPUT:
|
||||
GTK_VALUE_INT (*arg) = src->output;
|
||||
break;
|
||||
case ARG_PATERN:
|
||||
GTK_VALUE_STRING (*arg) = src->patern;
|
||||
case ARG_PATTERN:
|
||||
GTK_VALUE_STRING (*arg) = src->pattern;
|
||||
break;
|
||||
case ARG_NUM_BUFFERS:
|
||||
GTK_VALUE_INT (*arg) = src->num_buffers;
|
||||
|
@ -276,7 +282,7 @@ gst_fakesrc_get(GstPad *pad)
|
|||
src->num_buffers--;
|
||||
}
|
||||
|
||||
g_print("(%s:%s)> ",GST_DEBUG_PAD_NAME(pad));
|
||||
g_print("fakesrc: ******* (%s:%s)> \n",GST_DEBUG_PAD_NAME(pad));
|
||||
buf = gst_buffer_new();
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (src), gst_fakesrc_signals[SIGNAL_HANDOFF],
|
||||
|
@ -310,15 +316,23 @@ gst_fakesrc_loop(GstElement *element)
|
|||
GstPad *pad = GST_PAD (pads->data);
|
||||
GstBuffer *buf;
|
||||
|
||||
if (src->num_buffers == 0) {
|
||||
gst_pad_set_eos (pad);
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
if (src->num_buffers > 0)
|
||||
src->num_buffers--;
|
||||
}
|
||||
|
||||
buf = gst_buffer_new();
|
||||
g_print("(%s:%s)> ",GST_DEBUG_PAD_NAME(pad));
|
||||
g_print("fakesrc: ******* (%s:%s)> \n",GST_DEBUG_PAD_NAME(pad));
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (src), gst_fakesrc_signals[SIGNAL_HANDOFF],
|
||||
src);
|
||||
gst_pad_push (pad, buf);
|
||||
|
||||
if (!GST_ELEMENT_IS_COTHREAD_STOPPING (element)) break;
|
||||
|
||||
pads = g_slist_next (pads);
|
||||
}
|
||||
} while (!GST_ELEMENT_IS_COTHREAD_STOPPING (element));
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@ typedef enum {
|
|||
FAKESRC_PING_PONG,
|
||||
FAKESRC_ORDERED_RANDOM,
|
||||
FAKESRC_RANDOM,
|
||||
FAKESRC_PATERN_LOOP,
|
||||
FAKESRC_PING_PONG_PATERN,
|
||||
FAKESRC_PATTERN_LOOP,
|
||||
FAKESRC_PING_PONG_PATTERN,
|
||||
FAKESRC_GET_ALWAYS_SUCEEDS,
|
||||
} GstFakeSrcOutputType;
|
||||
|
||||
|
@ -68,8 +68,8 @@ struct _GstFakeSrc {
|
|||
gint numsrcpads;
|
||||
GSList *srcpads;
|
||||
GstFakeSrcOutputType output;
|
||||
gchar *patern;
|
||||
GList *paternlist;
|
||||
gchar *pattern;
|
||||
GList *patternlist;
|
||||
gint num_buffers;
|
||||
};
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
|
|||
g_return_if_fail (buf != NULL);
|
||||
|
||||
identity = GST_IDENTITY (pad->parent);
|
||||
g_print("(%s:%s)i ",GST_DEBUG_PAD_NAME(pad));
|
||||
g_print("identity: ******* (%s:%s)i \n",GST_DEBUG_PAD_NAME(pad));
|
||||
|
||||
gst_pad_push (identity->srcpad, buf);
|
||||
|
||||
|
@ -141,7 +141,7 @@ gst_identity_loop (GstElement *element)
|
|||
|
||||
do {
|
||||
buf = gst_pad_pull (identity->sinkpad);
|
||||
g_print("(%s:%s)i ",GST_DEBUG_PAD_NAME(identity->sinkpad));
|
||||
g_print("identity: ******* (%s:%s)i \n",GST_DEBUG_PAD_NAME(identity->sinkpad));
|
||||
|
||||
gst_pad_push (identity->srcpad, buf);
|
||||
|
||||
|
|
|
@ -197,6 +197,8 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf)
|
|||
GST_DEBUG (0,"queue: %s waiting %d\n", name, queue->level_buffers);
|
||||
STATUS("%s: O\n");
|
||||
//g_cond_timed_wait (queue->fullcond, queue->fulllock, queue->timeval);
|
||||
//FIXME need to signal other thread in case signals got lost?
|
||||
g_cond_signal (queue->emptycond);
|
||||
g_cond_wait (queue->fullcond, GST_OBJECT(queue)->lock);
|
||||
STATUS("%s: O+\n");
|
||||
GST_DEBUG (0,"queue: %s waiting done %d\n", name, queue->level_buffers);
|
||||
|
@ -247,6 +249,8 @@ gst_queue_get (GstPad *pad)
|
|||
while (!queue->level_buffers) {
|
||||
STATUS("queue: %s U released lock\n");
|
||||
//g_cond_timed_wait (queue->emptycond, queue->emptylock, queue->timeval);
|
||||
//FIXME need to signal other thread in case signals got lost?
|
||||
g_cond_signal (queue->fullcond);
|
||||
g_cond_wait (queue->emptycond, GST_OBJECT(queue)->lock);
|
||||
// STATUS("queue: %s U- getting lock\n");
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ gst_fakesink_chain (GstPad *pad, GstBuffer *buf)
|
|||
g_return_if_fail (buf != NULL);
|
||||
|
||||
fakesink = GST_FAKESINK (pad->parent);
|
||||
g_print("(%s:%s)< ",GST_DEBUG_PAD_NAME(pad));
|
||||
g_print("fakesink: ******* (%s:%s)< \n",GST_DEBUG_PAD_NAME(pad));
|
||||
|
||||
gst_buffer_unref (buf);
|
||||
|
||||
|
|
|
@ -29,7 +29,8 @@ GstElementDetails gst_fakesrc_details = {
|
|||
"Source",
|
||||
"Push empty (no data) buffers around",
|
||||
VERSION,
|
||||
"Erik Walthinsen <omega@cse.ogi.edu>",
|
||||
"Erik Walthinsen <omega@cse.ogi.edu>\n"
|
||||
"Wim Taymans <wim.taymans@chello.be>"
|
||||
"(C) 1999",
|
||||
};
|
||||
|
||||
|
@ -46,7 +47,7 @@ enum {
|
|||
ARG_NUM_SOURCES,
|
||||
ARG_LOOP_BASED,
|
||||
ARG_OUTPUT,
|
||||
ARG_PATERN,
|
||||
ARG_PATTERN,
|
||||
ARG_NUM_BUFFERS,
|
||||
};
|
||||
|
||||
|
@ -60,8 +61,8 @@ gst_fakesrc_output_get_type(void) {
|
|||
{ FAKESRC_PING_PONG, "3", "Ping-Pong"},
|
||||
{ FAKESRC_ORDERED_RANDOM, "4", "Ordered Random"},
|
||||
{ FAKESRC_RANDOM, "5", "Random"},
|
||||
{ FAKESRC_PATERN_LOOP, "6", "Patern loop"},
|
||||
{ FAKESRC_PING_PONG_PATERN, "7", "Ping-Pong Patern"},
|
||||
{ FAKESRC_PATTERN_LOOP, "6", "Patttern loop"},
|
||||
{ FAKESRC_PING_PONG_PATTERN, "7", "Ping-Pong Pattern"},
|
||||
{ FAKESRC_GET_ALWAYS_SUCEEDS, "8", "'_get' Always succeeds"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
@ -119,8 +120,8 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
|
|||
GTK_ARG_READWRITE, ARG_LOOP_BASED);
|
||||
gtk_object_add_arg_type ("GstFakeSrc::output", GST_TYPE_FAKESRC_OUTPUT,
|
||||
GTK_ARG_READWRITE, ARG_OUTPUT);
|
||||
gtk_object_add_arg_type ("GstFakeSrc::patern", GTK_TYPE_STRING,
|
||||
GTK_ARG_READWRITE, ARG_PATERN);
|
||||
gtk_object_add_arg_type ("GstFakeSrc::pattern", GTK_TYPE_STRING,
|
||||
GTK_ARG_READWRITE, ARG_PATTERN);
|
||||
gtk_object_add_arg_type ("GstFakeSrc::num_buffers", GTK_TYPE_INT,
|
||||
GTK_ARG_READWRITE, ARG_NUM_BUFFERS);
|
||||
|
||||
|
@ -146,11 +147,16 @@ gst_fakesrc_init (GstFakeSrc *fakesrc)
|
|||
|
||||
// create our first output pad
|
||||
pad = gst_pad_new("src",GST_PAD_SRC);
|
||||
gst_pad_set_get_function(pad,gst_fakesrc_get);
|
||||
gst_element_add_pad(GST_ELEMENT(fakesrc),pad);
|
||||
fakesrc->srcpads = g_slist_append(NULL,pad);
|
||||
|
||||
fakesrc->loop_based = FALSE;
|
||||
fakesrc->loop_based = TRUE;
|
||||
|
||||
if (fakesrc->loop_based)
|
||||
gst_element_set_loop_function (GST_ELEMENT (fakesrc), gst_fakesrc_loop);
|
||||
else
|
||||
gst_pad_set_get_function(pad,gst_fakesrc_get);
|
||||
|
||||
fakesrc->num_buffers = -1;
|
||||
// we're ready right away, since we don't have any args...
|
||||
// gst_element_set_state(GST_ELEMENT(fakesrc),GST_STATE_READY);
|
||||
|
@ -206,7 +212,7 @@ gst_fakesrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
|||
break;
|
||||
case ARG_OUTPUT:
|
||||
break;
|
||||
case ARG_PATERN:
|
||||
case ARG_PATTERN:
|
||||
break;
|
||||
case ARG_NUM_BUFFERS:
|
||||
src->num_buffers = GTK_VALUE_INT (*arg);
|
||||
|
@ -236,8 +242,8 @@ gst_fakesrc_get_arg (GtkObject *object, GtkArg *arg, guint id)
|
|||
case ARG_OUTPUT:
|
||||
GTK_VALUE_INT (*arg) = src->output;
|
||||
break;
|
||||
case ARG_PATERN:
|
||||
GTK_VALUE_STRING (*arg) = src->patern;
|
||||
case ARG_PATTERN:
|
||||
GTK_VALUE_STRING (*arg) = src->pattern;
|
||||
break;
|
||||
case ARG_NUM_BUFFERS:
|
||||
GTK_VALUE_INT (*arg) = src->num_buffers;
|
||||
|
@ -276,7 +282,7 @@ gst_fakesrc_get(GstPad *pad)
|
|||
src->num_buffers--;
|
||||
}
|
||||
|
||||
g_print("(%s:%s)> ",GST_DEBUG_PAD_NAME(pad));
|
||||
g_print("fakesrc: ******* (%s:%s)> \n",GST_DEBUG_PAD_NAME(pad));
|
||||
buf = gst_buffer_new();
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (src), gst_fakesrc_signals[SIGNAL_HANDOFF],
|
||||
|
@ -310,15 +316,23 @@ gst_fakesrc_loop(GstElement *element)
|
|||
GstPad *pad = GST_PAD (pads->data);
|
||||
GstBuffer *buf;
|
||||
|
||||
if (src->num_buffers == 0) {
|
||||
gst_pad_set_eos (pad);
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
if (src->num_buffers > 0)
|
||||
src->num_buffers--;
|
||||
}
|
||||
|
||||
buf = gst_buffer_new();
|
||||
g_print("(%s:%s)> ",GST_DEBUG_PAD_NAME(pad));
|
||||
g_print("fakesrc: ******* (%s:%s)> \n",GST_DEBUG_PAD_NAME(pad));
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (src), gst_fakesrc_signals[SIGNAL_HANDOFF],
|
||||
src);
|
||||
gst_pad_push (pad, buf);
|
||||
|
||||
if (!GST_ELEMENT_IS_COTHREAD_STOPPING (element)) break;
|
||||
|
||||
pads = g_slist_next (pads);
|
||||
}
|
||||
} while (!GST_ELEMENT_IS_COTHREAD_STOPPING (element));
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@ typedef enum {
|
|||
FAKESRC_PING_PONG,
|
||||
FAKESRC_ORDERED_RANDOM,
|
||||
FAKESRC_RANDOM,
|
||||
FAKESRC_PATERN_LOOP,
|
||||
FAKESRC_PING_PONG_PATERN,
|
||||
FAKESRC_PATTERN_LOOP,
|
||||
FAKESRC_PING_PONG_PATTERN,
|
||||
FAKESRC_GET_ALWAYS_SUCEEDS,
|
||||
} GstFakeSrcOutputType;
|
||||
|
||||
|
@ -68,8 +68,8 @@ struct _GstFakeSrc {
|
|||
gint numsrcpads;
|
||||
GSList *srcpads;
|
||||
GstFakeSrcOutputType output;
|
||||
gchar *patern;
|
||||
GList *paternlist;
|
||||
gchar *pattern;
|
||||
GList *patternlist;
|
||||
gint num_buffers;
|
||||
};
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
|
|||
g_return_if_fail (buf != NULL);
|
||||
|
||||
identity = GST_IDENTITY (pad->parent);
|
||||
g_print("(%s:%s)i ",GST_DEBUG_PAD_NAME(pad));
|
||||
g_print("identity: ******* (%s:%s)i \n",GST_DEBUG_PAD_NAME(pad));
|
||||
|
||||
gst_pad_push (identity->srcpad, buf);
|
||||
|
||||
|
@ -141,7 +141,7 @@ gst_identity_loop (GstElement *element)
|
|||
|
||||
do {
|
||||
buf = gst_pad_pull (identity->sinkpad);
|
||||
g_print("(%s:%s)i ",GST_DEBUG_PAD_NAME(identity->sinkpad));
|
||||
g_print("identity: ******* (%s:%s)i \n",GST_DEBUG_PAD_NAME(identity->sinkpad));
|
||||
|
||||
gst_pad_push (identity->srcpad, buf);
|
||||
|
||||
|
|
|
@ -197,6 +197,8 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf)
|
|||
GST_DEBUG (0,"queue: %s waiting %d\n", name, queue->level_buffers);
|
||||
STATUS("%s: O\n");
|
||||
//g_cond_timed_wait (queue->fullcond, queue->fulllock, queue->timeval);
|
||||
//FIXME need to signal other thread in case signals got lost?
|
||||
g_cond_signal (queue->emptycond);
|
||||
g_cond_wait (queue->fullcond, GST_OBJECT(queue)->lock);
|
||||
STATUS("%s: O+\n");
|
||||
GST_DEBUG (0,"queue: %s waiting done %d\n", name, queue->level_buffers);
|
||||
|
@ -247,6 +249,8 @@ gst_queue_get (GstPad *pad)
|
|||
while (!queue->level_buffers) {
|
||||
STATUS("queue: %s U released lock\n");
|
||||
//g_cond_timed_wait (queue->emptycond, queue->emptylock, queue->timeval);
|
||||
//FIXME need to signal other thread in case signals got lost?
|
||||
g_cond_signal (queue->fullcond);
|
||||
g_cond_wait (queue->emptycond, GST_OBJECT(queue)->lock);
|
||||
// STATUS("queue: %s U- getting lock\n");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue