Commit graph

1604 commits

Author SHA1 Message Date
Mark Nauwelaerts
d544b074b3 baseparse: ensure to preserve upstream timestamps
... rather than have subclass coming up with an internally parsed one.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=707230
2013-11-26 12:40:57 +01:00
Mark Nauwelaerts
fe63255c4e baseparse: try first frame pts and dts for a valid start timestamp 2013-11-09 10:30:36 +01:00
Mark Nauwelaerts
11ce36d40f baseparse: print proper variable in debug statement 2013-11-09 10:29:55 +01:00
Mark Nauwelaerts
8d818eb981 basesrc: mind boggling wrap when comparing offsets 2013-11-09 10:29:16 +01:00
Thibault Saunier
2bcafd4d56 collectpads: Call the collected function while it returns FLOW_OK
This allows us to make sure the elements is EOS and does not have
remaining buffers to be drained.

https://bugzilla.gnome.org/show_bug.cgi?id=709637
2013-10-10 18:57:45 -03:00
Sebastian Dröge
20f1c96c89 collectpads: Make sure that the object lock is always taken when accessing the private pad list
https://bugzilla.gnome.org/show_bug.cgi?id=708636
2013-09-24 10:44:34 +02:00
Mathieu Duponchelle
c79e5bbcad collectpads: Use private pad list in set_flushing_unlocked
pads->data is the public list. It is dynamically rebuilt at each call to
check_collected, in check_pads to be specific. When you add a pad and
collectpads have been started, it is not added to the public list.

Thus there exists a possible race where :

1) You would add a pad to collectpads while running.
2) You set collectpads to flushing before check_collected has been called again
-> the pad is not set to flushing
3) the pad starts pushing data as downstream might not be prepared, in the case
of adder it then returns FLOW_FLUSHING.
4) elements like demuxers, when they get a FLOW_FLUSHING, stop their tasks,
never to be seen again.

https://bugzilla.gnome.org/show_bug.cgi?id=708636
2013-09-24 10:44:34 +02:00
Mathieu Duponchelle
8d24c4e451 basetransform: implement a default transform_meta.
If a metadata has no dependency as shown by the tags, copy it.
2013-09-09 15:32:18 +02:00
Thiago Santos
3dc8ee97e5 basesrc: preserve seqnum on segments after seeks
The seqnum of the segment after a seek should be the same of
the seek event. Downstream elements might rely on seqnums to
identify events related to a seek.

This is particularly important when a demuxer maps a TIME seek
into a BYTES seek for upstream and it needs to identify the
corresponding segment event and map it back into TIME to push
downstream, possibly using the values from the original seek
event.

https://bugzilla.gnome.org/show_bug.cgi?id=707530
2013-09-05 15:40:04 -03:00
Zaheer Abbas Merali
d1d99af229 collectpads: Don't unref NULL GstCollectData
If a pad is removed while a collectpads element (say adder) is in a chain
function waiting to be collected, there is a possibility that an unref happens
on a NULL pointer.

https://bugzilla.gnome.org/show_bug.cgi?id=707536
2013-09-05 14:15:30 +02:00
Tim-Philipp Müller
3057001622 basesink: demote log message, don't spam INFO level when handling buffer lists 2013-08-29 11:07:38 +01:00
Edward Hervey
307d67f8c0 basetransform: Don't push out identical caps
This avoids triggering plenty of extra code/methods/overhead downstream when
we can just quickly check whenever we want to set caps whether they are
identical or not

https://bugzilla.gnome.org/show_bug.cgi?id=706600
2013-08-22 19:06:47 +02:00
Wim Taymans
44811ab650 basesrc: improve flush-start handling
Use custom code to implement flush-stop, we can't reuse the set_flushing code
because we can't touch the live_playing flag and we need to signal the
streaming thread.
2013-08-14 17:44:48 +02:00
Wim Taymans
9006f203d0 basesrc: stop flushing in flush-stop 2013-08-14 17:14:15 +02:00
Wim Taymans
d95c227641 basesrc: handle flush better
Unlock the streaming thread when flushing so that we can
insert the flush-stop correctly.
2013-08-14 16:58:41 +02:00
Edward Hervey
3c49b5d23b baseparse: Add a property to disable passthrough
In some specific cases (like transmuxing) we want to force the element
to actually parse all incoming data even if the element deems it is not
necessary.

This property simply ignores requests from the element to enable passthrough
mode which results in processing always being enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=705621
2013-08-13 17:11:35 +02:00
Thiago Santos
581c4297d0 dataqueue: add gst_data_queue_push_force
Adds a variant of the _push function that doesn't check the queue limits
before adding the new item. It is useful when pushing an element to the
queue shouldn't lock the thread.

One particular scenario is when the queue is used to serialize buffers
and events that are going to be pushed from another thread. The
dataqueue should have a limit on the amount of buffers to be stored to
avoid large memory consumption, but events can be considered to have
negligible impact on memory compared to buffers. So it is useful to be
used to push items into the queue that contain events, even though the
queue is already full, it shouldn't matter inserting an item that has
no significative size.

This scenario happens on adaptive elements (dashdemux / mssdemux) as
there is a single download thread fetching buffers and putting into the
dataqueues for the streams. This same download thread can als generate
events in some situations as caps changes, eos or a internal control
events. There can be a deadlock at preroll if the first buffer fetched
is large enough to fill the dataqueue and the download thread and the
next iteration of the download thread decides to push an event to this
same dataqueue before fetching buffers to other streams, if this push
locks, the pipeline will be stuck in preroll as no more buffers will be
downloaded.
There is a somewhat common practice in dash streams to have a single
very large buffer for audio and one for video, so this will always
happen as the download thread will have to push an EOS right after
fetching the first buffer for any stream.

API: gst_data_queue_push_force

https://bugzilla.gnome.org/show_bug.cgi?id=705694
2013-08-13 12:00:48 -03:00
Nicolas Dufresne
de75bca9b3 bytereader: Accelerate MPEG/H264 start code scanning
Accelerate MPEG/H264 start code scanning using Boyer-Moor bad character
heuristic.

https://bugzilla.gnome.org/show_bug.cgi?id=702357
2013-08-10 18:54:34 -04:00
Edward Hervey
991d6462a8 typefindhelper: Avoid using buffer_get_size in tight loops
Calling gst_buffer_get_size represented 2/3 of the cost of helper_find_peek
which was called whenever a typefindfunction wanted to peek at data.

We already know the size (from the GstMapInfo), so just use that.
2013-07-30 06:59:44 +02:00
Sebastian Dröge
ef8455d395 base: Fix handling of SEGMENT query
The values should be in stream-time, and start/stop should not
be swapped for negative rates.
2013-07-29 12:10:45 +02:00
Sebastian Dröge
eb67ca7625 baseparse: Implement SEGMENT query 2013-07-29 10:49:18 +02:00
Thiago Santos
aa5ea6d80e baseparse: fix seqnum handling for seeks
Use the same seqnum as the seek for flushes/segments that are
caused by the seek. Also do the same for segment events

Fixes #676242
2013-07-25 15:19:35 -03:00
Sebastian Dröge
bfb6844399 basesink: Don't shadow variables that are set inside our scope and then used outside our scope
Fixes uninitialized use of these variables.
2013-07-24 11:21:27 +02:00
Sebastian Dröge
0a41beaa56 basesink: Print some debug output if a stream-start event without group-id arrives
Ideally all elements would implement handling of that to get proper
stream-start message handling and other things.
2013-07-23 18:53:44 +02:00
Sebastian Dröge
6363216e43 base: Use new group-id field in stream-start event and message 2013-07-22 15:30:10 +02:00
Olivier Crête
915f418cc4 adapter: Take account of the skip in gst_adapter_take_buffer_fast()
Include regression test
2013-07-16 15:38:11 -04:00
Olivier Crête
5920491597 adapter: Add function to return buffer composed of multiple memories
API: gst_adapter_take_fast()
2013-07-16 14:07:48 -04:00
Sebastian Dröge
d60c2c2864 basesrc: Leave the loop function faster if we're flushing
Especially don't even try to send stream-start event or try
to negotiate.

https://bugzilla.gnome.org/show_bug.cgi?id=704100
2013-07-15 11:32:10 +02:00
Thibault Saunier
6cc39f42a9 basesrc: Do not lock a mutex that does not exist
The GST_LIVE_LOCK is on GstBaseSrc, not on its source pad.
2013-07-04 20:56:19 -04:00
Wim Taymans
97b1e17b09 baseparse: reset PTS after seek
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=702778
2013-07-03 21:26:18 +02:00
Nicolas Dufresne
4656d18fd5 Add few missing allow-none annotation 2013-07-03 14:25:07 -04:00
Sjoerd Simons
12a72d2b08 basetransform: optimize default acceptcaps implementation
Pass the fixed caps we're asked to accept as a filter for the caps
query, so we don't get a fully-expanded set of caps back (which we don't
need and can take a lot of time for intersection).

This reduces the time for camerabin to produce a second frame on a
logitech C910 camera from around 52 seconds to a bit less then 16
seconds on my system.

https://bugzilla.gnome.org/show_bug.cgi?id=702632
2013-06-19 15:11:57 +02:00
Wim Taymans
124b8e38af basesink: call state change in all cases
When we asynchronously go from READY to PLAYING, also call the
state change function so that subclasses can update their state for PLAYING.
Because the PREROLL lock is not recursive, we can't make this without
races and we must assume for now that the subclass can handle concurrent calls
to PAUSED->PLAYING and PLAYING->PAUSED. We can make this assumption because not
many elements actually do something in those state changes and the ones that
did would be broken even more without this change.

https://bugzilla.gnome.org/show_bug.cgi?id=702282
2013-06-17 10:36:34 +02:00
Sebastian Dröge
bab1122a93 basesrc: Only force-update the duration for dynamic sources when doing the DURATION query
Doing it after every single create() is not very efficient and not necessary.
Especially on network file systems fstat() is not cached and causes network
traffic, making the source possibly unusable slow.

https://bugzilla.gnome.org/show_bug.cgi?id=652037
2013-06-06 16:46:12 +02:00
Wim Taymans
cf4334fbfb basesink: improve position reporting without clock
When no base time or when sync is disabled, use the same logic as
in paused to report position. The logic in PLAYING assumes we use the
clock.
2013-05-30 06:51:24 +02:00
Tim-Philipp Müller
4d1cb14c68 basetransform: remove 0.10-ism from docs
gst_buffer_pad_alloc() never existed, and gst_pad_alloc_buffer()
doesn't exist any more either, so don't mention it in the docs.

https://bugzilla.gnome.org/show_bug.cgi?id=694714
2013-05-24 23:01:09 +01:00
Sebastian Dröge
3e515099ec basetransform: Return GST_FLOW_ERROR if the allocator did not allow to allocate a buffer 2013-05-24 14:37:37 +02:00
Sebastian Dröge
1319196349 basesrc: Add FIXME comment for unused assignment results 2013-05-08 08:52:25 +02:00
Sebastian Dröge
f27a3e12f6 baseparse: Only infer TS if PTS interpolation is enabled
Otherwise this is breaking timestamps of formats that
need reordering.

https://bugzilla.gnome.org/show_bug.cgi?id=597662
2013-04-23 11:49:15 +02:00
Sebastian Dröge
86b4e1841e basesink: Don't set last_render_time if we're checking for a late buffer before ::prepare()
This makes sure that at least one buffer per second is rendered if buffers
are dropped before ::prepare. Without this change, at least one buffer per
second wouldn't be too late before ::prepare anymore but would be dropped
before ::render because of last_render_time being set before ::prepare
already.
2013-04-19 10:57:01 +02:00
Thiago Santos
1681a1b1e0 dataqueue: add gst_data_queue_peek
This function works just like gst_data_queue_pop, but it doesn't
remove the object from the queue.

Useful when inspecting multiple GstDataQueues to decide from which
to pop the element from.

Add: gst_data_queue_peek
2013-04-18 14:45:47 -03:00
Douglas Bagnall
39716e555b GstCollectPads documentation: gst_collect_pads_read is gone. 2013-04-11 10:39:25 +02:00
Josep Torra
3c9dfaea38 basesink: fixes compiler warning
gstbasesink.c: In function 'gst_base_sink_chain_unlocked':
gstbasesink.c:3204: warning: 'ret' may be used uninitialized in this function
2013-03-30 10:24:27 +01:00
Mark Nauwelaerts
6ddbaaa95c baseparse: reset next_pts upon SEGMENT event
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=691481
2013-03-27 18:26:30 +01:00
Mark Nauwelaerts
76acdee908 baseparse: more inter-timestamp tracking
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=691481
2013-03-27 18:26:30 +01:00
Nicolas Dufresne
253035d395 basesrc: Don't send error if negotiate fails because we are flushing
Negotiation may be aborted by a flush from another thread that need to
stop the task (i.e. seek). Check that case and silently pause the task.

https://bugzilla.gnome.org/show_bug.cgi?id=696357
2013-03-25 08:57:06 +01:00
Tim-Philipp Müller
f40aa2c4ad basesink: fix use of uninitialized variable
Running suite(s): GstBaseSink
==22023== Conditional jump or move depends on uninitialised value(s)
==22023==    at 0x505FFCE: gst_base_sink_get_sync_times (gstbasesink.c:1936)
==22023==    by 0x5068C80: gst_base_sink_do_sync (gstbasesink.c:2379)
==22023==    by 0x506BCD2: gst_base_sink_default_wait_event (gstbasesink.c:2903)
==22023==    by 0x50633A4: gst_base_sink_default_event (gstbasesink.c:2918)
==22023==    by 0x6F5C216: gst_fake_sink_event (gstfakesink.c:383)
==22023==    by 0x505F164: gst_base_sink_event (gstbasesink.c:3108)
==22023==    by 0x52FA090: gst_pad_send_event_unchecked (gstpad.c:4822)
==22023==    by 0x5303756: gst_pad_send_event (gstpad.c:4984)
==22023==    by 0x40165B: basesink_test_gap (basesink.c:148)
2013-03-03 16:03:42 +00:00
David Schleef
f671bd2754 collectpads: take DTS into account
Importantly, this patch converts DTS to running time.  Less importantly,
and possibly a problem for some muxers, is that it orders buffers by
DTS (if it is valid, otherwise PTS).  This is generally correct, but
might be somewhat surprising to muxers.

Also note that once converted to running time, DTS can end up negative.
2013-03-02 10:42:01 -08:00
Stefan Sauer
82f7bdd7bb seeking: add more logging for seeking
Especially add logging to error code paths.
2013-02-27 22:17:17 +01:00
Tim-Philipp Müller
5a73d15c80 basetransform: don't pass NULL outcaps to transform_size on shutdown
gst_pad_get_current_caps() on the source pad might yield NULL caps
if we're being shut down and the source pad has already been
deactivated by the other thread that's changing state. Just bail
out in that case, instead of passing NULL caps to the transform_size
function, which it might not expect.

Fixes spurious warnings in audioresample shutdown unit test.

https://bugzilla.gnome.org/show_bug.cgi?id=693996
2013-02-21 11:28:12 +00:00