Commit graph

1757 commits

Author SHA1 Message Date
Sebastian Dröge
717ad20912 inputselector: Deactivate and remove pad without the inputselector lock
Otherwise we might get deadlocks caused by lock order inversion:
During the chain function the stream lock is first locked and then the
inputselector lock. During pad release we first locked the inputselector
lock and then deactivating the pad would lock the stream lock.

There's no reason why the inputselector lock should be required while
deactivating and removing the pad, it's only needed before.

https://bugzilla.gnome.org/show_bug.cgi?id=704002
2013-07-12 10:08:26 +02:00
Sebastian Dröge
c8cfaff1ff inputselector: Keep previous active sinkpad around until we're done with it
Otherwise we'll send a new segment event downstream for each buffer.
2013-07-10 14:30:31 +02:00
Olivier Crête
bbb26f8756 funnel: Re-push all sticky events when buffers come from a different pad
Don't special case segment/caps, just push all sticky events when they are
received on the currently active pad or when the active pad changes.
2013-07-01 20:45:42 -04:00
Olivier Crête
176e16aa5f funnel: Use default pad function for upstream event/queries
The default functions in 1.x already do the right thing
2013-07-01 20:21:10 -04:00
Wim Taymans
2f78e96299 queue2: only block serialized query when it's safe
We must be certain that we don't cause a deadlock when blocking the serialized
queries. One such deadlock can happen when we are buffering and downstream is
blocked in preroll and a serialized query arrives. Downstream will not unblock
(and allow our query to execute) until we complete buffering and buffering will
not complete until we can answer the query..

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=702840
2013-06-24 23:29:16 +02:00
Sebastian Dröge
2f8e572887 queue: Don't hold the queue mutex while doing serialized queries downstream
https://bugzilla.gnome.org/show_bug.cgi?id=702520
2013-06-19 10:53:21 +02:00
Brendan Long
f0a3d8bb09 input-selector: send notify::active signal for input-selector pads.
https://bugzilla.gnome.org/show_bug.cgi?id=701319
2013-06-06 17:16:47 +02:00
Brendan Long
76f0e18f92 input-selector: return FALSE for "active" property if selector is NULL
https://bugzilla.gnome.org/show_bug.cgi?id=701323
2013-06-04 17:46:25 +02:00
Sebastian Dröge
ab6a1085ee (multi)queue: Don't access query items during flushing 2013-05-27 16:38:18 +02:00
Sebastian Dröge
e472d9d261 multiqueue: Don't do serialized queries when we're flushing
Just immediately fail the query, otherwise we would wait forever
for the query to be answered.
2013-05-27 16:22:00 +02:00
Sebastian Dröge
a03435dfba queue2: First set query result, then signal GCond 2013-05-27 16:08:39 +02:00
Sebastian Dröge
6f042f13ae queue: Fix handling of serialized queries
During FLUSH_START the query needs to be unblocked already, otherwise
it can lead to deadlocks if the FLUSH_START is the result of something
done from the streaming thread of the srcpad (the queue will never be
emptied!).
2013-05-27 15:59:07 +02:00
Sebastian Dröge
cdc429f296 queue2: Unblock any waiting serialize queries on FLUSH_START
Fixes some deadlocks during flushing.

And store queue items differently to not accidentially read
already unreffed queries when flushing. Queries are owned by
upstream and not us.
2013-05-27 15:41:14 +02:00
Sebastian Dröge
b6fac17502 queue/queue2/multiqueue: When flushing, make sure to not lose any sticky events
https://bugzilla.gnome.org/show_bug.cgi?id=688824
2013-05-27 13:01:43 +02:00
Nicolas Dufresne
5bbc6f1c8c valve: Don't read sticky flag from unrefed event 2013-05-25 22:03:53 -04:00
Tim-Philipp Müller
789b68e506 tee: fix property description for now-unused "alloc-pad" property
Should probably proxy ALLOCATION queries on that though, if set.
But what else? CAPS and ACCEPT_CAPS too?
2013-05-24 23:28:04 +01:00
Sebastian Dröge
e692993e79 queue2: Add support for serialized queries if using a memory queue 2013-05-24 19:22:22 +02:00
Sebastian Dröge
46270f8925 queue: Set the last serialized query result to FALSE when flushing 2013-05-24 18:47:24 +02:00
Sebastian Dröge
a79d3a0220 multiqueue: Initialize all GstMultiQueueItem fields in both code paths 2013-05-24 18:42:55 +02:00
Sebastian Dröge
1c6341e6a4 multiqueue: Don't access the query after signalling the waiting thread
It might've free'd the query already.
2013-05-24 18:38:40 +02:00
Sebastian Dröge
3b44a44a01 multiqueue: Make sure to always signal any possible pending serialized queries
And don't unref them when flushing the queue, they're owned by the caller!

https://bugzilla.gnome.org/show_bug.cgi?id=700342
2013-05-24 18:30:44 +02:00
Sebastian Dröge
1d1946a321 typefind: Handle the force-caps property more similar to all typefinding code flow
This makes sure that events happen in order and simplifies the code a bit.
2013-05-15 13:22:04 +02:00
Sebastian Dröge
8e1f70473b queue: Store sticky events on the srcpad if we're dropping them because of leaking 2013-05-09 12:50:20 +02:00
Sebastian Dröge
f93c52684a outputselector: Always forward sticky events to all pads 2013-05-09 12:27:12 +02:00
Sebastian Dröge
1d40478014 inputselector: Forward all sticky events, including stream-start 2013-05-09 12:15:48 +02:00
Sebastian Dröge
172817e332 capsfilter: Add more debug output and forward caps events immediately too 2013-05-09 09:51:13 +02:00
Sebastian Dröge
e4cbae46cc capsfilter: Fix typo in last commit 2013-05-09 09:38:35 +02:00
Sebastian Dröge
98f6b75cd3 capsfilter: Send all events that should happen after CAPS after the CAPS event 2013-05-09 09:32:49 +02:00
Nicolas Dufresne
c86f42bc88 capsfilter: Send caps before segment
In the case the source has no caps, caps must be sent before segment. This
fixes few unit tests that where failing due to the new misordering warning.

https://bugzilla.gnome.org/show_bug.cgi?id=699968
2013-05-09 09:14:49 +02:00
Nicolas Dufresne
ba354f6b03 typefind: Send stream-start before anything else
To do so, send stream-start when the streaming thread goes up for the first
time.

https://bugzilla.gnome.org/show_bug.cgi?id=699767
2013-05-07 09:17:13 +02:00
Sebastian Dröge
c24bcbf511 typefind: Always leave TYPEFIND mode when we're stopping typefinding 2013-04-29 13:24:56 +02:00
Sebastian Dröge
11f6e08aae typefind: Simplify code
This is only called when in TYPEFIND mode.
2013-04-29 13:24:56 +02:00
Sebastian Dröge
7982f682dd typefind: Push pending events independent of the existence of a downstream chain function and peer
Downstream might create a peer only as result of the events in theory.
2013-04-29 13:24:56 +02:00
Sebastian Dröge
32e05f8a1e typefind: Only push CAPS event once if we get one from upstream
https://bugzilla.gnome.org/show_bug.cgi?id=692784
2013-04-29 13:24:56 +02:00
Sebastian Dröge
2a34f767d4 typefind: Stop typefinding if we get a CAPS event from upstream 2013-04-29 13:24:56 +02:00
Sebastian Dröge
0fda329bbb typefind: Improve handling of GAP events
There's still room for improvement though.
2013-04-29 13:24:56 +02:00
Sebastian Dröge
fc4105c1f9 typefind: Forward events that should happen before the caps event directly
There's no point in storing them and sending them later, and doing so would
later require to distinguish between events that should come before caps and
after.

https://bugzilla.gnome.org/show_bug.cgi?id=692784
2013-04-29 13:24:56 +02:00
Sebastian Dröge
cf0566f9ca typefind: Only push pending buffers and events if we have caps 2013-04-29 13:24:56 +02:00
Sebastian Dröge
922815996f typefind: Remove code that would cause caps to be sent twice
Whenever we set typefind->caps we will also send a caps event downstream.
2013-04-29 13:24:56 +02:00
Tim-Philipp Müller
e1c6a56596 typefind: fix caps leak when used in connection with uridecodebin and playbin
Don't leak forced sink caps.
2013-04-27 00:05:45 +01:00
Sebastian Dröge
a257cb6f5b inputselector: Try to not push read-only buffers
We should only increase the refcount before pushing if we're
really going to use the buffer afterwards.
2013-04-25 16:39:52 +02:00
Sebastian Dröge
18a7a1d062 gst: Add better support for static plugins
API: GST_PLUGIN_STATIC_DECLARE()
API: GST_PLUGIN_STATIC_REGISTER()

Based on a patch by Håvard Graff <havard.graff@tandberg.com>.

This now allows GST_PLUGIN_DEFINE() to create a static plugin if
GST_PLUGIN_BUILD_STATIC is defined. The resulting plugin can be
statically linked or dynamically linked during compilation but
can't be dynamically loaded during runtime.

Also adds GST_PLUGIN_STATIC_DECLARE() and GST_PLUGIN_STATIC_REGISTER(),
which allows to register a static linked plugin easily.
It is still required to manually register every single statically linked
plugin from inside the application as this can't be automated in a portable
way.

A new configure parameter --enable-static-plugins was added that allows
to build all plugins we build here as static plugins.

Fixes bug #667305.
2013-04-15 15:52:18 +02:00
Wim Taymans
fa371dad6d multiqueue: ignore empty not-linked queues
We need to ignore the not-linked queues in the underrun and overrun callbacks
because they are expected to be empty.
2013-04-05 10:15:37 +02:00
Wim Taymans
bda406c42f multiqueue: start pushing again on RECONFIGURE
When we got NOT_LINKED before and we receive a RECONFIGURE event, start pushing
again on the source pad.

See https://bugzilla.gnome.org/show_bug.cgi?id=676304
2013-04-04 19:16:23 +02:00
Wim Taymans
9ac409df48 queue2: start pushing again on RECONFIGURE
When we got NOT_LINKED before and we receive a RECONFIGURE event, start pushing
again on the source pad.

See https://bugzilla.gnome.org/show_bug.cgi?id=676304
2013-04-04 19:07:29 +02:00
Wim Taymans
c955ddc712 queue: start pushing again on RECONFIGURE
When we got NOT_LINKED before and we receive a RECONFIGURE event, start pushing
again on the source pad.

See https://bugzilla.gnome.org/show_bug.cgi?id=676304
2013-04-04 19:06:35 +02:00
Alexander Schrab
09bb0c2cdb queue: remove query from queue if queue is flushing
When querying a queue that is flushing we end up adding
a query to the queuearray without taking a reference to
that query (because the normal functionality is to block
until that query is done and discarded from the queue).
This later causes problem if the query is unreffed outside
of the queue before we discard the queue. There is a check
to avoid unreffing any lingering query-objects, but since
the query has been deleted that check fails.

This commit depends on other fixes done to gst_queue_array_find()
and gst_queue_array_drop_element().

https://bugzilla.gnome.org/show_bug.cgi?id=692691
2013-01-30 12:07:52 +00:00
Branko Subasic
17bff49262 multiqueue: correct overrun handling
The control of wheteher a SingleQueue is full is not correct.
Rewrote single_queue_overrun_cb() so it checks the correct variables
when checking if the queue has reached the hard limits, and to
increase the max buffer limit once for each call.

https://bugzilla.gnome.org/show_bug.cgi?id=690557
2012-12-20 15:34:01 +01:00
Wim Taymans
6c968bbdf1 queue2: implement buffering query for all modes
Also implement the buffering query for STREAM mode.
2012-12-20 11:59:54 +01:00
Wim Taymans
7c056a9473 queue2: refactor buffering percent and stats
Make methods to get the current buffering percent and the stats. We will use
this in the query later.
2012-12-20 11:30:25 +01:00
Wim Taymans
fac7eb0a50 NEWSEGMENT -> SEGMENT 2012-12-14 15:24:30 +01:00
Arnaud Vrac
b4a91de1be inputselector: fix clock leak in wait_running_time
https://bugzilla.gnome.org/show_bug.cgi?id=688477
2012-11-17 10:17:58 +00:00
Alessandro Decina
a47e5c72d0 queue: remove unused label. Fixes compiler warning. 2012-11-10 09:51:10 +01:00
Alessandro Decina
c257b19ead queue: don't fail in _sink_event for sticky events
Implement the same behaviour as gst_pad_push_event when pushing sticky events
fails, that is don't fail immediately but fail when data flow resumes and upstream
can aggregate properly.

This fixes segment seeks with decodebin and unlinked audio or video branches.
Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=687899
2012-11-09 18:42:16 +01:00
Tim-Philipp Müller
c99bafae39 elements: fix leading space in plugin description string 2012-11-06 16:58:04 +00:00
Tim-Philipp Müller
666c8c11c6 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-03 20:44:48 +00:00
Tim-Philipp Müller
af2482b170 queue: add "flush-on-eos" property
In flush-on-eos=true mode any data remaining in the queue is
discarded when an EOS event is received, and the EOS passed
downstream as soon as possible (instead of waiting for all
buffers in the queue to get processed by downstream first).

May or may not be useful in capture/encoding scenarios.
2012-10-31 19:33:30 +00:00
Jan Schmidt
698324d48b multiqueue: Add EOS status to debug output about filled/unfilled 2012-10-30 10:04:14 +11:00
Sebastian Dröge
09982c3c13 dataqueue/queuearray: Make public API again
These are actually used outside of coreelements nowadays.
Also hide lots of internals and add padding and documentation.
2012-10-25 14:03:01 +02:00
Wim Taymans
fc5849ef11 capsfilter: don't prefer passthrough
Basetransform should not try to negotiate in passthrough mode but
respect the order of what we return in the transform_caps method.
A typical case is that you specify some specific new caps in the
caps property but also allow the current caps to pass.
2012-10-04 11:18:19 +02:00
Wim Taymans
701424be9b typefind: send STREAM-START event
Send a STREAM_START event when we are operating in pull mode.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=684424
2012-09-26 13:25:03 +02:00
Mark Nauwelaerts
b14a3ad4ef identity: retimestamp both pts and dts when doing so 2012-09-26 10:55:47 +02:00
Mark Nauwelaerts
8e98ce54e1 identity: also track and store segment info in single segment mode 2012-09-25 15:06:43 +02:00
Josep Torra Valles
111fcc6e31 Make intel compiler happier
https://bugzilla.gnome.org/show_bug.cgi?id=552657
2012-09-25 00:56:26 +01:00
Mark Nauwelaerts
f495fa7a21 identity: transform GAP event in single segment mode 2012-09-19 15:14:35 +02:00
Wim Taymans
3abc720345 docs: fix some docs
from git grep for ffmpegcolorspace and x-raw-
2012-09-13 11:35:41 +02:00
Mark Nauwelaerts
947635d893 filesink: fix build on Cygwin
... where __fbufsize is not available
2012-09-12 17:16:41 +02:00
Tim-Philipp Müller
2fe8ebaae6 queue2: fix possible data corruption in ring buffer mode when seeking
Fix race that could cause data corruption when seeking in ring buffer
mode.

In perform_seek_to_offset(), called from the demuxer's pull_range
request, we drop the lock, tell upstream (usually a http source)
to seek to a different offset, then re-acquire the lock before we
do things to the ranges. However, between us sending the seek event
and re-acquiring the lock, the source thread might already have pushed
some data and moved along the range's writing_pos beyond the seek
offset. In that case we don't want to set the writing position back
to the requested seek position, as it would cause data to be written
to the wrong offset in the file or ring buffer.

Reproducible doing seek-emulated fast-forward/backward on 006653.

Conflicts:
	plugins/elements/gstqueue2.c
2012-09-12 12:59:50 +01:00
Tim-Philipp Müller
a85991eeb8 baseparse, typefind: only activate in pull mode if upstream is seekable
Upstream might support pull mode, but only sequential pulls,
which isn't gonna do much for us.

https://bugzilla.gnome.org/show_bug.cgi?id=634927
2012-09-11 01:40:53 +01:00
Jan Schmidt
8d8608c23b ghostpad: Make some debugging more verbose
Also, remove an unnecessary #include in input-selector
2012-08-31 06:25:37 -07:00
Arnaud Vrac
dc86e65265 inputselector: fix clock leak
https://bugzilla.gnome.org/show_bug.cgi?id=682997
2012-08-30 19:47:57 +01:00
Edward Hervey
0eb13f146f inputselector: Wait for other streams to advance on unselected pads
Otherwise we end up dropping a lot of data in the case where data starts
arriving on the non-selected pad, resulting in big gaps in stream switching
2012-08-14 18:44:38 +02:00
Edward Hervey
6b447acc3c inputselector: More debug statements 2012-08-14 18:43:54 +02:00
Edward Hervey
c33d2f7aba inputselector: Don't forward stream-start sticky events
Only one STREAM_START event should be let through, else it will
confuse downstream elements that think a new stream is starting
whereas in fact we are just switching to a different input.

In the future we might want to let them through but with the same
sequence number.
2012-08-14 18:42:31 +02:00
Edward Hervey
ea761a24b4 inputselector: Use the first created pad by default
This guarantees a bit more consistency in which input stream will
be selected by default. It would previously be the first pad on which
an event/buffer/query was received ... which was racy and non-predictable.
2012-08-06 11:36:29 +02:00
Tim-Philipp Müller
a9d1c529f6 input-selector: use generic marshaller for "block" action signal 2012-08-05 16:48:27 +01:00
Tim-Philipp Müller
ba39106758 typefind: send segment_done event in addition to segment_done message 2012-08-02 00:22:29 +01:00
Sebastian Dröge
389ec66946 basesrc: Add default handler for URI query in GstURIHandler subclasses 2012-07-31 17:26:37 +02:00
Wim Taymans
f05b0e222f Update for new seeking variable name
When seeking, the start value and type are now called start and start_type.
2012-07-27 15:24:52 +02:00
Wim Taymans
a1f1bbd363 typefind: require bytes before typefinding
Require that we have some bytes in the adapter before we attempt to typefind.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=680479
2012-07-24 12:38:15 +02:00
Wim Taymans
a21575d640 plugins: print flags better
print the buffer flags as a hex number so that it becomes easier to see what
flags are set.
2012-07-23 13:40:38 +02:00
Wim Taymans
b5caa93f6d queue2: set buffering-left to 0 on 100% buffering
Set the buffering-left field in the query to 0 when we are completely buffered.
Improve the debug.
2012-07-19 12:42:05 +02:00
Wim Taymans
60091bf225 queue2: fix buffering query
Fix the buffering query, fill in the right buffering-left and estimated-total
values.
2012-07-19 12:14:29 +02:00
Wim Taymans
14550f2ee2 queue2: fix the buffering-left in the buffering message
The buffering-left field in the buffering message should contain a time estimate
in milliseconds about for long the buffering is going to take. We can calculate
this value when we do rate_estimates.
2012-07-19 11:13:45 +02:00
Tim-Philipp Müller
eecaca9140 queue: answer SCHEDULING query
Instead of letting the default query handler fail.
2012-07-18 09:15:51 +01:00
Tim-Philipp Müller
39054884fd queue2: handle CAPS event and drop it if operating in ring buffer mode
Fixes "Unexpected event of kind caps can't be added in temp file"
warning when doing download buffering.
2012-07-17 19:27:44 +01:00
Tim-Philipp Müller
f72ba83a84 plugins: embed GstAueueArray in dataqueue struct as well 2012-07-14 20:33:30 +01:00
Tim-Philipp Müller
92cba34e0b plugins: don't use one-time array in plugin_init 2012-07-14 20:28:54 +01:00
Tim-Philipp Müller
22d78bad25 queue: embed GstQueueArray structure 2012-07-14 20:26:23 +01:00
Tim-Philipp Müller
14632db174 plugins: sprinkle some more G_GNUC_INTERNAL 2012-07-14 20:05:53 +01:00
Tim-Philipp Müller
2b17de7504 plugins: add init/clear functions to GstQueueArray 2012-07-14 19:38:39 +01:00
Tim-Philipp Müller
94f6ba9c0b base: make GstQueueArray private to coreelements for now
Keep it private until we have a reason to make it public.
2012-07-14 19:36:02 +01:00
Edward Hervey
d3ffa82639 Remove 0.10-related documentation and "Since" markers 2012-07-10 12:03:27 +02:00
Tim-Philipp Müller
c51a2c1ddf basesrc, basesink, baseparse, typefind: use GST_SEGMENT_FLAG with segment flags 2012-07-09 21:51:07 +01:00
Tim-Philipp Müller
a8d5665db7 plugins: sprinkle G_GNUC_INTERNAL for dataqueue functions
And remove padding, since this is not public API any more.
2012-07-09 20:55:39 +01:00
Sebastian Dröge
af73f3fc02 queue: Fix handling of min-threshold and serialized queries
Only consider the queue empty if the minimum thresholds
are not reached and data is at the queue head. Otherwise
we would block forever on serialized queries.

This also makes sending of serialized events, like caps, happen
faster and potentially improves negotiation performance.

Fixes bug #679458.
2012-07-09 15:40:29 +02:00
Tim-Philipp Müller
dcc35b9c67 typefindelement: remove unimplemented maximum property 2012-07-06 11:26:14 +01:00
Tim-Philipp Müller
388237756e tee: remove unimplemented has-sink-loop property 2012-07-06 11:26:14 +01:00
Tim-Philipp Müller
41a762adb3 queue2: remove deprecated temp-location use, make it read-only 2012-07-06 11:26:14 +01:00
Tim-Philipp Müller
b23185a73a identity: remove deprecated check-perfect property
Replaced by the more specific check-imperfect-{timestamp,offset}
2012-07-06 11:26:14 +01:00