mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 17:51:16 +00:00
gst/elements/gstfilesrc.c: compute mapsize correctly
Original commit message from CVS: * gst/elements/gstfilesrc.c: (gst_filesrc_get_mmap): compute mapsize correctly * gst/elements/gstfilesrc.c: (gst_filesrc_get_mmap): use correct datatypes when calling a varargs function * gst/elements/gsttypefindelement.c: (stop_typefinding): push a DISCONT event as first thing * gst/gst_private.h: * gst/gstinfo.c: (_gst_debug_init): remove GST_DATAFLOW debugging category * gst/gstbin.c: (gst_bin_iterate): use GST_SCHEDULING category * gst/gstpad.c: (gst_pad_get_type), (_invent_event), (gst_pad_push), (gst_pad_pull), (gst_pad_call_chain_function), (gst_pad_call_get_function): add GST_DATAFLOW to easily track flow of buffers or events. * gst/gstqueue.c: (gst_queue_get_type), (gst_queue_handle_pending_events), (gst_queue_chain), (gst_queue_get), (gst_queue_handle_src_event): use own static debugging category GST_DATAFLOW for dataflow, use DEBUG category for showing which path events go, use LOG category for buffers.
This commit is contained in:
parent
3a79c0a7e9
commit
ac83b103a1
11 changed files with 130 additions and 81 deletions
24
ChangeLog
24
ChangeLog
|
@ -1,3 +1,27 @@
|
|||
2004-05-11 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
||||
|
||||
* gst/elements/gstfilesrc.c: (gst_filesrc_get_mmap):
|
||||
compute mapsize correctly
|
||||
* gst/elements/gstfilesrc.c: (gst_filesrc_get_mmap):
|
||||
use correct datatypes when calling a varargs function
|
||||
* gst/elements/gsttypefindelement.c: (stop_typefinding):
|
||||
push a DISCONT event as first thing
|
||||
* gst/gst_private.h:
|
||||
* gst/gstinfo.c: (_gst_debug_init):
|
||||
remove GST_DATAFLOW debugging category
|
||||
* gst/gstbin.c: (gst_bin_iterate):
|
||||
use GST_SCHEDULING category
|
||||
* gst/gstpad.c: (gst_pad_get_type), (_invent_event),
|
||||
(gst_pad_push), (gst_pad_pull), (gst_pad_call_chain_function),
|
||||
(gst_pad_call_get_function):
|
||||
add GST_DATAFLOW to easily track flow of buffers or events.
|
||||
* gst/gstqueue.c: (gst_queue_get_type),
|
||||
(gst_queue_handle_pending_events), (gst_queue_chain),
|
||||
(gst_queue_get), (gst_queue_handle_src_event):
|
||||
use own static debugging category GST_DATAFLOW for dataflow,
|
||||
use DEBUG category for showing which path events go, use LOG
|
||||
category for buffers.
|
||||
|
||||
2004-05-10 David Schleef <ds@schleef.org>
|
||||
|
||||
* docs/gst/gstreamer-sections.txt: Add gst_element_no_more_pads.
|
||||
|
|
|
@ -585,7 +585,7 @@ gst_filesrc_get_mmap (GstFileSrc * src)
|
|||
mapsize = src->mapsize;
|
||||
|
||||
/* double the mapsize as long as the readsize is smaller */
|
||||
while (readsize - (src->curoffset - nextmap) > mapsize) {
|
||||
while (readsize + src->curoffset > nextmap + mapsize) {
|
||||
GST_LOG_OBJECT (src, "readsize smaller then mapsize %08x %d",
|
||||
readsize, (int) mapsize);
|
||||
mapsize <<= 1;
|
||||
|
@ -693,7 +693,7 @@ gst_filesrc_get (GstPad * pad)
|
|||
GST_DEBUG_OBJECT (src, "sending discont");
|
||||
event =
|
||||
gst_event_new_discontinuous (src->need_discont > 1, GST_FORMAT_BYTES,
|
||||
src->curoffset, NULL);
|
||||
(guint64) src->curoffset, GST_FORMAT_UNDEFINED);
|
||||
src->need_discont = 0;
|
||||
return GST_DATA (event);
|
||||
}
|
||||
|
|
|
@ -359,6 +359,9 @@ stop_typefinding (GstTypeFindElement * typefind)
|
|||
GST_WARNING_OBJECT (typefind,
|
||||
"could not seek to required position %u, hope for the best", size);
|
||||
}
|
||||
gst_pad_push (typefind->src, GST_DATA (gst_event_new_discontinuous (TRUE,
|
||||
GST_FORMAT_DEFAULT, (guint64) 0, GST_FORMAT_BYTES, (guint64) 0,
|
||||
GST_FORMAT_UNDEFINED)));
|
||||
if (size
|
||||
&& (buffer = gst_buffer_store_get_buffer (typefind->store, 0, size))) {
|
||||
GST_DEBUG_OBJECT (typefind, "pushing cached data (%u bytes)", size);
|
||||
|
|
|
@ -54,7 +54,6 @@ extern GstDebugCategory *GST_CAT_PARENTAGE;
|
|||
extern GstDebugCategory *GST_CAT_STATES;
|
||||
extern GstDebugCategory *GST_CAT_PLANNING;
|
||||
extern GstDebugCategory *GST_CAT_SCHEDULING;
|
||||
extern GstDebugCategory *GST_CAT_DATAFLOW;
|
||||
extern GstDebugCategory *GST_CAT_BUFFER;
|
||||
extern GstDebugCategory *GST_CAT_CAPS;
|
||||
extern GstDebugCategory *GST_CAT_CLOCK;
|
||||
|
|
|
@ -1149,19 +1149,19 @@ gst_bin_iterate (GstBin * bin)
|
|||
g_return_val_if_fail (bin != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_BIN (bin), FALSE);
|
||||
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, bin, "starting iteration");
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, bin, "starting iteration");
|
||||
|
||||
gst_object_ref (GST_OBJECT (bin));
|
||||
|
||||
running = FALSE;
|
||||
g_signal_emit (G_OBJECT (bin), gst_bin_signals[ITERATE], 0, &running);
|
||||
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, bin, "finished iteration");
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, bin, "finished iteration");
|
||||
|
||||
if (!running) {
|
||||
if (GST_STATE (bin) == GST_STATE_PLAYING &&
|
||||
GST_STATE_PENDING (bin) == GST_STATE_VOID_PENDING) {
|
||||
GST_CAT_DEBUG (GST_CAT_DATAFLOW,
|
||||
GST_CAT_DEBUG (GST_CAT_SCHEDULING,
|
||||
"[%s]: polling for child shutdown after useless iteration",
|
||||
GST_ELEMENT_NAME (bin));
|
||||
g_usleep (1);
|
||||
|
|
|
@ -137,7 +137,6 @@ GstDebugCategory *GST_CAT_PARENTAGE = NULL;
|
|||
GstDebugCategory *GST_CAT_STATES = NULL;
|
||||
GstDebugCategory *GST_CAT_PLANNING = NULL;
|
||||
GstDebugCategory *GST_CAT_SCHEDULING = NULL;
|
||||
GstDebugCategory *GST_CAT_DATAFLOW = NULL;
|
||||
GstDebugCategory *GST_CAT_BUFFER = NULL;
|
||||
GstDebugCategory *GST_CAT_CAPS = NULL;
|
||||
GstDebugCategory *GST_CAT_CLOCK = NULL;
|
||||
|
@ -237,8 +236,6 @@ _gst_debug_init (void)
|
|||
GST_DEBUG_BOLD | GST_DEBUG_FG_MAGENTA, NULL);
|
||||
GST_CAT_SCHEDULING = _gst_debug_category_new ("GST_SCHEDULING",
|
||||
GST_DEBUG_BOLD | GST_DEBUG_FG_MAGENTA, NULL);
|
||||
GST_CAT_DATAFLOW = _gst_debug_category_new ("GST_DATAFLOW",
|
||||
GST_DEBUG_BOLD | GST_DEBUG_FG_GREEN, NULL);
|
||||
GST_CAT_BUFFER = _gst_debug_category_new ("GST_BUFFER",
|
||||
GST_DEBUG_BOLD | GST_DEBUG_FG_GREEN, NULL);
|
||||
GST_CAT_CAPS = _gst_debug_category_new ("GST_CAPS",
|
||||
|
|
47
gst/gstpad.c
47
gst/gstpad.c
|
@ -33,9 +33,18 @@
|
|||
#include "gsterror.h"
|
||||
#include "gstvalue.h"
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (debug_dataflow);
|
||||
#define DEBUG_DATA(obj,data,notice) G_STMT_START{\
|
||||
if (GST_IS_EVENT (data)) { \
|
||||
GST_CAT_DEBUG_OBJECT (debug_dataflow, obj, "%s event %p (type %d)", notice, data, \
|
||||
GST_EVENT_TYPE (data)); \
|
||||
} else { \
|
||||
GST_CAT_LOG_OBJECT (debug_dataflow, obj, "%s buffer %p (size %d)", notice, data, \
|
||||
GST_BUFFER_SIZE (data)); \
|
||||
} \
|
||||
}G_STMT_END
|
||||
#define GST_CAT_DEFAULT GST_CAT_PADS
|
||||
|
||||
|
||||
struct _GstPadLink
|
||||
{
|
||||
GType type;
|
||||
|
@ -102,6 +111,9 @@ gst_pad_get_type (void)
|
|||
|
||||
_gst_pad_type = g_type_register_static (GST_TYPE_OBJECT, "GstPad",
|
||||
&pad_info, 0);
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (debug_dataflow, "GST_DATAFLOW",
|
||||
GST_DEBUG_BOLD | GST_DEBUG_FG_GREEN, "dataflow inside pads");
|
||||
}
|
||||
return _gst_pad_type;
|
||||
}
|
||||
|
@ -3088,14 +3100,14 @@ _invent_event (GstPad * pad, GstBuffer * buffer)
|
|||
|
||||
event = gst_event_new_discontinuous (TRUE,
|
||||
GST_FORMAT_TIME, timestamp, event_type, offset, GST_FORMAT_UNDEFINED);
|
||||
GST_CAT_WARNING (GST_CAT_DATAFLOW,
|
||||
GST_CAT_WARNING (GST_CAT_SCHEDULING,
|
||||
"needed to invent a DISCONT (time %" G_GUINT64_FORMAT
|
||||
") for %s:%s => %s:%s", timestamp,
|
||||
GST_DEBUG_PAD_NAME (GST_PAD_PEER (pad)), GST_DEBUG_PAD_NAME (pad));
|
||||
} else {
|
||||
event = gst_event_new_discontinuous (TRUE,
|
||||
event_type, offset, GST_FORMAT_UNDEFINED);
|
||||
GST_CAT_WARNING (GST_CAT_DATAFLOW,
|
||||
GST_CAT_WARNING (GST_CAT_SCHEDULING,
|
||||
"needed to invent a DISCONT (no time) for %s:%s => %s:%s",
|
||||
GST_DEBUG_PAD_NAME (GST_PAD_PEER (pad)), GST_DEBUG_PAD_NAME (pad));
|
||||
}
|
||||
|
@ -3120,17 +3132,18 @@ gst_pad_push (GstPad * pad, GstData * data)
|
|||
g_return_if_fail (GST_PAD_DIRECTION (pad) == GST_PAD_SRC);
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
DEBUG_DATA (pad, data, "gst_pad_push");
|
||||
if (!gst_probe_dispatcher_dispatch (&(GST_REAL_PAD (pad)->probedisp), &data))
|
||||
return;
|
||||
|
||||
if (!GST_PAD_IS_LINKED (pad)) {
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, pad,
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
|
||||
"not pushing data %p as pad is unconnected", data);
|
||||
gst_data_unref (data);
|
||||
return;
|
||||
}
|
||||
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, pad, "pushing");
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad, "pushing");
|
||||
peer = GST_RPAD_PEER (pad);
|
||||
|
||||
if (!peer) {
|
||||
|
@ -3145,7 +3158,7 @@ gst_pad_push (GstPad * pad, GstData * data)
|
|||
|
||||
if (peer->chainhandler) {
|
||||
if (data) {
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, pad,
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
|
||||
"calling chainhandler &%s of peer pad %s:%s",
|
||||
GST_DEBUG_FUNCPTR_NAME (peer->chainhandler),
|
||||
GST_DEBUG_PAD_NAME (GST_PAD (peer)));
|
||||
|
@ -3182,8 +3195,7 @@ GstData *
|
|||
gst_pad_pull (GstPad * pad)
|
||||
{
|
||||
GstRealPad *peer;
|
||||
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, pad, "pulling");
|
||||
GstData *data;
|
||||
|
||||
g_return_val_if_fail (GST_PAD_DIRECTION (pad) == GST_PAD_SINK,
|
||||
GST_DATA (gst_event_new (GST_EVENT_INTERRUPT)));
|
||||
|
@ -3197,9 +3209,8 @@ gst_pad_pull (GstPad * pad)
|
|||
restart:
|
||||
if (peer->gethandler) {
|
||||
GstPadLink *link = GST_RPAD_LINK (pad);
|
||||
GstData *data;
|
||||
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, pad,
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
|
||||
"calling gethandler %s of peer pad %s:%s",
|
||||
GST_DEBUG_FUNCPTR_NAME (peer->gethandler), GST_DEBUG_PAD_NAME (peer));
|
||||
|
||||
|
@ -3225,13 +3236,14 @@ gst_pad_pull (GstPad * pad)
|
|||
GST_EVENT_TYPE (data) == GST_EVENT_DISCONTINUOUS &&
|
||||
GST_EVENT_DISCONT_NEW_MEDIA (data)) {
|
||||
link->engaged = TRUE;
|
||||
GST_CAT_LOG (GST_CAT_DATAFLOW,
|
||||
GST_CAT_LOG (GST_CAT_SCHEDULING,
|
||||
"link engaged by discont event for pad %s:%s",
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
}
|
||||
}
|
||||
if (!gst_probe_dispatcher_dispatch (&peer->probedisp, &data))
|
||||
goto restart;
|
||||
DEBUG_DATA (pad, data, "gst_pad_pull returned");
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -3244,7 +3256,9 @@ gst_pad_pull (GstPad * pad)
|
|||
GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (peer)));
|
||||
}
|
||||
}
|
||||
return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT));
|
||||
data = GST_DATA (gst_event_new (GST_EVENT_INTERRUPT));
|
||||
DEBUG_DATA (pad, data, "gst_pad_pull returned created");
|
||||
return data;
|
||||
}
|
||||
|
||||
GstData *
|
||||
|
@ -4272,6 +4286,7 @@ gst_pad_get_formats (GstPad * pad)
|
|||
|
||||
#define CALL_CHAINFUNC(pad, data) G_STMT_START {\
|
||||
GstData *__temp = (data); \
|
||||
DEBUG_DATA (pad, __temp, "calling chain function with "); \
|
||||
if (GST_IS_EVENT (__temp) && \
|
||||
!GST_FLAG_IS_SET (gst_pad_get_parent (pad), GST_ELEMENT_EVENT_AWARE)) { \
|
||||
gst_pad_send_event (pad, GST_EVENT (__temp)); \
|
||||
|
@ -4312,7 +4327,7 @@ gst_pad_call_chain_function (GstPad * pad, GstData * data)
|
|||
GST_EVENT_TYPE (data) == GST_EVENT_DISCONTINUOUS &&
|
||||
GST_EVENT_DISCONT_NEW_MEDIA (data)) {
|
||||
link->engaged = TRUE;
|
||||
GST_CAT_LOG (GST_CAT_DATAFLOW,
|
||||
GST_CAT_LOG (GST_CAT_SCHEDULING,
|
||||
"link engaged by discont event for pad %s:%s",
|
||||
GST_DEBUG_PAD_NAME (pad));
|
||||
}
|
||||
|
@ -4333,9 +4348,13 @@ gst_pad_call_chain_function (GstPad * pad, GstData * data)
|
|||
GstData *
|
||||
gst_pad_call_get_function (GstPad * pad)
|
||||
{
|
||||
GstData *data;
|
||||
|
||||
g_return_val_if_fail (GST_IS_REAL_PAD (pad), NULL);
|
||||
g_return_val_if_fail (GST_PAD_IS_SRC (pad), NULL);
|
||||
g_return_val_if_fail (GST_RPAD_GETFUNC (pad) != NULL, NULL);
|
||||
|
||||
return GST_RPAD_GETFUNC (pad) (pad);
|
||||
data = GST_RPAD_GETFUNC (pad) (pad);
|
||||
DEBUG_DATA (pad, data, "getfunction returned");
|
||||
return data;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include "gstinfo.h"
|
||||
#include "gsterror.h"
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (queue_dataflow);
|
||||
|
||||
static GstElementDetails gst_queue_details = GST_ELEMENT_DETAILS ("Queue",
|
||||
"Generic",
|
||||
"Simple data queue",
|
||||
|
@ -138,6 +140,8 @@ gst_queue_get_type (void)
|
|||
|
||||
queue_type = g_type_register_static (GST_TYPE_ELEMENT,
|
||||
"GstQueue", &queue_info, 0);
|
||||
GST_DEBUG_CATEGORY_INIT (queue_dataflow, "queue_dataflow", 0,
|
||||
"dataflow inside the queue element");
|
||||
}
|
||||
|
||||
return queue_type;
|
||||
|
@ -388,16 +392,16 @@ gst_queue_handle_pending_events (GstQueue * queue)
|
|||
while (!g_queue_is_empty (queue->events)) {
|
||||
GstQueueEventResponse *er = g_queue_pop_head (queue->events);
|
||||
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "sending event upstream");
|
||||
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "sending event upstream");
|
||||
er->ret = gst_pad_event_default (queue->srcpad, er->event);
|
||||
er->handled = TRUE;
|
||||
g_cond_signal (queue->event_done);
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "event sent");
|
||||
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "event sent");
|
||||
}
|
||||
}
|
||||
|
||||
#define STATUS(queue, msg) \
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, \
|
||||
GST_CAT_LOG_OBJECT (queue_dataflow, queue, \
|
||||
"(%s:%s) " msg ": %u of %u-%u buffers, %u of %u-%u " \
|
||||
"bytes, %" G_GUINT64_FORMAT " of %" G_GUINT64_FORMAT \
|
||||
"-%" G_GUINT64_FORMAT " ns, %u elements", \
|
||||
|
@ -426,10 +430,9 @@ gst_queue_chain (GstPad * pad, GstData * data)
|
|||
|
||||
restart:
|
||||
/* we have to lock the queue since we span threads */
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "locking t:%p",
|
||||
g_thread_self ());
|
||||
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "locking t:%p", g_thread_self ());
|
||||
g_mutex_lock (queue->qlock);
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "locked t:%p", g_thread_self ());
|
||||
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "locked t:%p", g_thread_self ());
|
||||
|
||||
gst_queue_handle_pending_events (queue);
|
||||
|
||||
|
@ -448,14 +451,14 @@ restart:
|
|||
break;
|
||||
default:
|
||||
/* we put the event in the queue, we don't have to act ourselves */
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
||||
"adding event %p of type %d", data, GST_EVENT_TYPE (data));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (GST_IS_BUFFER (data))
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
||||
"adding buffer %p of size %d", data, GST_BUFFER_SIZE (data));
|
||||
|
||||
/* We make space available if we're "full" according to whatever
|
||||
|
@ -476,7 +479,7 @@ restart:
|
|||
switch (queue->leaky) {
|
||||
/* leak current buffer */
|
||||
case GST_QUEUE_LEAK_UPSTREAM:
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue,
|
||||
"queue is full, leaking buffer on upstream end");
|
||||
/* now we can clean up and exit right away */
|
||||
g_mutex_unlock (queue->qlock);
|
||||
|
@ -490,7 +493,7 @@ restart:
|
|||
GList *item;
|
||||
GstData *leak = NULL;
|
||||
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue,
|
||||
"queue is full, leaking buffer on downstream end");
|
||||
|
||||
for (item = queue->queue->head; item != NULL; item = item->next) {
|
||||
|
@ -541,7 +544,7 @@ restart:
|
|||
* or its manager, switch back to iterator so bottom
|
||||
* half of state change executes */
|
||||
if (queue->interrupt) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "interrupted");
|
||||
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "interrupted");
|
||||
g_mutex_unlock (queue->qlock);
|
||||
if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->sinkpad),
|
||||
GST_ELEMENT (queue))) {
|
||||
|
@ -551,11 +554,11 @@ restart:
|
|||
* flush, we don't need to add the buffer to the
|
||||
* queue again */
|
||||
if (queue->flush) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue,
|
||||
"not adding pending buffer after flush");
|
||||
goto out_unref;
|
||||
}
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue,
|
||||
"adding pending buffer after interrupt");
|
||||
goto restart;
|
||||
}
|
||||
|
@ -572,7 +575,7 @@ restart:
|
|||
* unref the buffer *before* calling GST_ELEMENT_ERROR */
|
||||
return;
|
||||
} else {
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_WARNING_OBJECT (queue_dataflow, queue,
|
||||
"%s: waiting for the app to restart "
|
||||
"source pad elements", GST_ELEMENT_NAME (queue));
|
||||
}
|
||||
|
@ -616,7 +619,7 @@ restart:
|
|||
|
||||
STATUS (queue, "+ level");
|
||||
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "signalling item_add");
|
||||
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "signalling item_add");
|
||||
g_cond_signal (queue->item_add);
|
||||
g_mutex_unlock (queue->qlock);
|
||||
|
||||
|
@ -640,10 +643,9 @@ gst_queue_get (GstPad * pad)
|
|||
|
||||
restart:
|
||||
/* have to lock for thread-safety */
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"locking t:%p", g_thread_self ());
|
||||
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "locking t:%p", g_thread_self ());
|
||||
g_mutex_lock (queue->qlock);
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "locked t:%p", g_thread_self ());
|
||||
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "locked t:%p", g_thread_self ());
|
||||
|
||||
if (queue->queue->length == 0 ||
|
||||
(queue->min_threshold.buffers > 0 &&
|
||||
|
@ -668,7 +670,7 @@ restart:
|
|||
* manager, switch back to iterator so bottom half of state
|
||||
* change executes. */
|
||||
if (queue->interrupt) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "interrupted");
|
||||
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "interrupted");
|
||||
g_mutex_unlock (queue->qlock);
|
||||
if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->srcpad),
|
||||
GST_ELEMENT (queue)))
|
||||
|
@ -683,7 +685,7 @@ restart:
|
|||
("deadlock found, shutting down sink pad elements"));
|
||||
goto restart;
|
||||
} else {
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_WARNING_OBJECT (queue_dataflow, queue,
|
||||
"%s: waiting for the app to restart "
|
||||
"source pad elements", GST_ELEMENT_NAME (queue));
|
||||
}
|
||||
|
@ -698,7 +700,7 @@ restart:
|
|||
g_time_val_add (&timeout, queue->block_timeout / 1000);
|
||||
if (!g_cond_timed_wait (queue->item_add, queue->qlock, &timeout)) {
|
||||
g_mutex_unlock (queue->qlock);
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_WARNING_OBJECT (queue_dataflow, queue,
|
||||
"Sending filler event");
|
||||
return GST_DATA (gst_event_new_filler ());
|
||||
}
|
||||
|
@ -716,7 +718,7 @@ restart:
|
|||
|
||||
/* There's something in the list now, whatever it is */
|
||||
data = g_queue_pop_head (queue->queue);
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
||||
"retrieved data %p from queue", data);
|
||||
|
||||
if (data == NULL)
|
||||
|
@ -736,7 +738,7 @@ restart:
|
|||
|
||||
STATUS (queue, "after _get()");
|
||||
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "signalling item_del");
|
||||
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "signalling item_del");
|
||||
g_cond_signal (queue->item_del);
|
||||
g_mutex_unlock (queue->qlock);
|
||||
|
||||
|
@ -748,7 +750,7 @@ restart:
|
|||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_EOS:
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue,
|
||||
"queue \"%s\" eos", GST_ELEMENT_NAME (queue));
|
||||
gst_element_set_eos (GST_ELEMENT (queue));
|
||||
break;
|
||||
|
@ -776,7 +778,7 @@ gst_queue_handle_src_event (GstPad * pad, GstEvent * event)
|
|||
er.event = event;
|
||||
er.handled = FALSE;
|
||||
g_queue_push_tail (queue->events, &er);
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_WARNING_OBJECT (queue_dataflow, queue,
|
||||
"Preparing for loop for event handler");
|
||||
/* see the chain function on why this is here - it prevents a deadlock */
|
||||
g_cond_signal (queue->item_del);
|
||||
|
@ -787,7 +789,7 @@ gst_queue_handle_src_event (GstPad * pad, GstEvent * event)
|
|||
g_time_val_add (&timeout, 500 * 1000); /* half a second */
|
||||
if (!g_cond_timed_wait (queue->event_done, queue->qlock, &timeout) &&
|
||||
!er.handled) {
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_WARNING_OBJECT (queue_dataflow, queue,
|
||||
"timeout in upstream event handling");
|
||||
/* remove ourselves from the pending list. Since we're
|
||||
* locked, others cannot reference this anymore. */
|
||||
|
@ -799,14 +801,14 @@ gst_queue_handle_src_event (GstPad * pad, GstEvent * event)
|
|||
goto handled;
|
||||
}
|
||||
}
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue, "Event handled");
|
||||
GST_CAT_WARNING_OBJECT (queue_dataflow, queue, "Event handled");
|
||||
res = er.ret;
|
||||
} else {
|
||||
res = gst_pad_event_default (pad, event);
|
||||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_FLUSH:
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue,
|
||||
"FLUSH event, flushing queue\n");
|
||||
gst_queue_locked_flush (queue);
|
||||
break;
|
||||
|
|
|
@ -585,7 +585,7 @@ gst_filesrc_get_mmap (GstFileSrc * src)
|
|||
mapsize = src->mapsize;
|
||||
|
||||
/* double the mapsize as long as the readsize is smaller */
|
||||
while (readsize - (src->curoffset - nextmap) > mapsize) {
|
||||
while (readsize + src->curoffset > nextmap + mapsize) {
|
||||
GST_LOG_OBJECT (src, "readsize smaller then mapsize %08x %d",
|
||||
readsize, (int) mapsize);
|
||||
mapsize <<= 1;
|
||||
|
@ -693,7 +693,7 @@ gst_filesrc_get (GstPad * pad)
|
|||
GST_DEBUG_OBJECT (src, "sending discont");
|
||||
event =
|
||||
gst_event_new_discontinuous (src->need_discont > 1, GST_FORMAT_BYTES,
|
||||
src->curoffset, NULL);
|
||||
(guint64) src->curoffset, GST_FORMAT_UNDEFINED);
|
||||
src->need_discont = 0;
|
||||
return GST_DATA (event);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include "gstinfo.h"
|
||||
#include "gsterror.h"
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (queue_dataflow);
|
||||
|
||||
static GstElementDetails gst_queue_details = GST_ELEMENT_DETAILS ("Queue",
|
||||
"Generic",
|
||||
"Simple data queue",
|
||||
|
@ -138,6 +140,8 @@ gst_queue_get_type (void)
|
|||
|
||||
queue_type = g_type_register_static (GST_TYPE_ELEMENT,
|
||||
"GstQueue", &queue_info, 0);
|
||||
GST_DEBUG_CATEGORY_INIT (queue_dataflow, "queue_dataflow", 0,
|
||||
"dataflow inside the queue element");
|
||||
}
|
||||
|
||||
return queue_type;
|
||||
|
@ -388,16 +392,16 @@ gst_queue_handle_pending_events (GstQueue * queue)
|
|||
while (!g_queue_is_empty (queue->events)) {
|
||||
GstQueueEventResponse *er = g_queue_pop_head (queue->events);
|
||||
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "sending event upstream");
|
||||
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "sending event upstream");
|
||||
er->ret = gst_pad_event_default (queue->srcpad, er->event);
|
||||
er->handled = TRUE;
|
||||
g_cond_signal (queue->event_done);
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "event sent");
|
||||
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "event sent");
|
||||
}
|
||||
}
|
||||
|
||||
#define STATUS(queue, msg) \
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, \
|
||||
GST_CAT_LOG_OBJECT (queue_dataflow, queue, \
|
||||
"(%s:%s) " msg ": %u of %u-%u buffers, %u of %u-%u " \
|
||||
"bytes, %" G_GUINT64_FORMAT " of %" G_GUINT64_FORMAT \
|
||||
"-%" G_GUINT64_FORMAT " ns, %u elements", \
|
||||
|
@ -426,10 +430,9 @@ gst_queue_chain (GstPad * pad, GstData * data)
|
|||
|
||||
restart:
|
||||
/* we have to lock the queue since we span threads */
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "locking t:%p",
|
||||
g_thread_self ());
|
||||
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "locking t:%p", g_thread_self ());
|
||||
g_mutex_lock (queue->qlock);
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "locked t:%p", g_thread_self ());
|
||||
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "locked t:%p", g_thread_self ());
|
||||
|
||||
gst_queue_handle_pending_events (queue);
|
||||
|
||||
|
@ -448,14 +451,14 @@ restart:
|
|||
break;
|
||||
default:
|
||||
/* we put the event in the queue, we don't have to act ourselves */
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
||||
"adding event %p of type %d", data, GST_EVENT_TYPE (data));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (GST_IS_BUFFER (data))
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
||||
"adding buffer %p of size %d", data, GST_BUFFER_SIZE (data));
|
||||
|
||||
/* We make space available if we're "full" according to whatever
|
||||
|
@ -476,7 +479,7 @@ restart:
|
|||
switch (queue->leaky) {
|
||||
/* leak current buffer */
|
||||
case GST_QUEUE_LEAK_UPSTREAM:
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue,
|
||||
"queue is full, leaking buffer on upstream end");
|
||||
/* now we can clean up and exit right away */
|
||||
g_mutex_unlock (queue->qlock);
|
||||
|
@ -490,7 +493,7 @@ restart:
|
|||
GList *item;
|
||||
GstData *leak = NULL;
|
||||
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue,
|
||||
"queue is full, leaking buffer on downstream end");
|
||||
|
||||
for (item = queue->queue->head; item != NULL; item = item->next) {
|
||||
|
@ -541,7 +544,7 @@ restart:
|
|||
* or its manager, switch back to iterator so bottom
|
||||
* half of state change executes */
|
||||
if (queue->interrupt) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "interrupted");
|
||||
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "interrupted");
|
||||
g_mutex_unlock (queue->qlock);
|
||||
if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->sinkpad),
|
||||
GST_ELEMENT (queue))) {
|
||||
|
@ -551,11 +554,11 @@ restart:
|
|||
* flush, we don't need to add the buffer to the
|
||||
* queue again */
|
||||
if (queue->flush) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue,
|
||||
"not adding pending buffer after flush");
|
||||
goto out_unref;
|
||||
}
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue,
|
||||
"adding pending buffer after interrupt");
|
||||
goto restart;
|
||||
}
|
||||
|
@ -572,7 +575,7 @@ restart:
|
|||
* unref the buffer *before* calling GST_ELEMENT_ERROR */
|
||||
return;
|
||||
} else {
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_WARNING_OBJECT (queue_dataflow, queue,
|
||||
"%s: waiting for the app to restart "
|
||||
"source pad elements", GST_ELEMENT_NAME (queue));
|
||||
}
|
||||
|
@ -616,7 +619,7 @@ restart:
|
|||
|
||||
STATUS (queue, "+ level");
|
||||
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "signalling item_add");
|
||||
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "signalling item_add");
|
||||
g_cond_signal (queue->item_add);
|
||||
g_mutex_unlock (queue->qlock);
|
||||
|
||||
|
@ -640,10 +643,9 @@ gst_queue_get (GstPad * pad)
|
|||
|
||||
restart:
|
||||
/* have to lock for thread-safety */
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
"locking t:%p", g_thread_self ());
|
||||
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "locking t:%p", g_thread_self ());
|
||||
g_mutex_lock (queue->qlock);
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "locked t:%p", g_thread_self ());
|
||||
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "locked t:%p", g_thread_self ());
|
||||
|
||||
if (queue->queue->length == 0 ||
|
||||
(queue->min_threshold.buffers > 0 &&
|
||||
|
@ -668,7 +670,7 @@ restart:
|
|||
* manager, switch back to iterator so bottom half of state
|
||||
* change executes. */
|
||||
if (queue->interrupt) {
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "interrupted");
|
||||
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "interrupted");
|
||||
g_mutex_unlock (queue->qlock);
|
||||
if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->srcpad),
|
||||
GST_ELEMENT (queue)))
|
||||
|
@ -683,7 +685,7 @@ restart:
|
|||
("deadlock found, shutting down sink pad elements"));
|
||||
goto restart;
|
||||
} else {
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_WARNING_OBJECT (queue_dataflow, queue,
|
||||
"%s: waiting for the app to restart "
|
||||
"source pad elements", GST_ELEMENT_NAME (queue));
|
||||
}
|
||||
|
@ -698,7 +700,7 @@ restart:
|
|||
g_time_val_add (&timeout, queue->block_timeout / 1000);
|
||||
if (!g_cond_timed_wait (queue->item_add, queue->qlock, &timeout)) {
|
||||
g_mutex_unlock (queue->qlock);
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_WARNING_OBJECT (queue_dataflow, queue,
|
||||
"Sending filler event");
|
||||
return GST_DATA (gst_event_new_filler ());
|
||||
}
|
||||
|
@ -716,7 +718,7 @@ restart:
|
|||
|
||||
/* There's something in the list now, whatever it is */
|
||||
data = g_queue_pop_head (queue->queue);
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
||||
"retrieved data %p from queue", data);
|
||||
|
||||
if (data == NULL)
|
||||
|
@ -736,7 +738,7 @@ restart:
|
|||
|
||||
STATUS (queue, "after _get()");
|
||||
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "signalling item_del");
|
||||
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "signalling item_del");
|
||||
g_cond_signal (queue->item_del);
|
||||
g_mutex_unlock (queue->qlock);
|
||||
|
||||
|
@ -748,7 +750,7 @@ restart:
|
|||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_EOS:
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue,
|
||||
"queue \"%s\" eos", GST_ELEMENT_NAME (queue));
|
||||
gst_element_set_eos (GST_ELEMENT (queue));
|
||||
break;
|
||||
|
@ -776,7 +778,7 @@ gst_queue_handle_src_event (GstPad * pad, GstEvent * event)
|
|||
er.event = event;
|
||||
er.handled = FALSE;
|
||||
g_queue_push_tail (queue->events, &er);
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_WARNING_OBJECT (queue_dataflow, queue,
|
||||
"Preparing for loop for event handler");
|
||||
/* see the chain function on why this is here - it prevents a deadlock */
|
||||
g_cond_signal (queue->item_del);
|
||||
|
@ -787,7 +789,7 @@ gst_queue_handle_src_event (GstPad * pad, GstEvent * event)
|
|||
g_time_val_add (&timeout, 500 * 1000); /* half a second */
|
||||
if (!g_cond_timed_wait (queue->event_done, queue->qlock, &timeout) &&
|
||||
!er.handled) {
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_WARNING_OBJECT (queue_dataflow, queue,
|
||||
"timeout in upstream event handling");
|
||||
/* remove ourselves from the pending list. Since we're
|
||||
* locked, others cannot reference this anymore. */
|
||||
|
@ -799,14 +801,14 @@ gst_queue_handle_src_event (GstPad * pad, GstEvent * event)
|
|||
goto handled;
|
||||
}
|
||||
}
|
||||
GST_CAT_WARNING_OBJECT (GST_CAT_DATAFLOW, queue, "Event handled");
|
||||
GST_CAT_WARNING_OBJECT (queue_dataflow, queue, "Event handled");
|
||||
res = er.ret;
|
||||
} else {
|
||||
res = gst_pad_event_default (pad, event);
|
||||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_FLUSH:
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue,
|
||||
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue,
|
||||
"FLUSH event, flushing queue\n");
|
||||
gst_queue_locked_flush (queue);
|
||||
break;
|
||||
|
|
|
@ -359,6 +359,9 @@ stop_typefinding (GstTypeFindElement * typefind)
|
|||
GST_WARNING_OBJECT (typefind,
|
||||
"could not seek to required position %u, hope for the best", size);
|
||||
}
|
||||
gst_pad_push (typefind->src, GST_DATA (gst_event_new_discontinuous (TRUE,
|
||||
GST_FORMAT_DEFAULT, (guint64) 0, GST_FORMAT_BYTES, (guint64) 0,
|
||||
GST_FORMAT_UNDEFINED)));
|
||||
if (size
|
||||
&& (buffer = gst_buffer_store_get_buffer (typefind->store, 0, size))) {
|
||||
GST_DEBUG_OBJECT (typefind, "pushing cached data (%u bytes)", size);
|
||||
|
|
Loading…
Reference in a new issue