Commit graph

174 commits

Author SHA1 Message Date
Eunhae Choi
ebd2748cd0 inputselector: Fix buffer leak in sync_streams & cache_buffers mode
After doing gst_pad_push() in case of sync_streams and cache_buffers,
if the buffer can not be kept in cache, it should be unreffed to avoid
memory leackage.

https://bugzilla.gnome.org/show_bug.cgi?id=755141
2015-09-21 10:33:55 +02:00
Luis de Bethencourt
c635f38cdc inputselector: remove always-true check
event can't be NULL, it has been dereferenced by GST_EVENT_TYPE (), and no
case frees the pointer. Remove unnecessary check which will always be True.

CID #1308955
2015-07-02 15:10:58 +01:00
Song Bing
e9c9a1e3e2 inputselector: Handle different duration track selection
Support track switch from EOS track to non-EOS one.

https://bugzilla.gnome.org/show_bug.cgi?id=750761
2015-06-23 15:28:13 +02:00
Thiago Santos
88a898080a inputselector: Only try to push the first EOS received
Subsequent EOS will push on the source pad that already received
EOS and that will make the event function return FALSE. It needs
only to push the first one and only return TRUE for the subsequent
ones.
2015-04-24 17:19:49 -03:00
Guillaume Desmottes
b15e6f4bf0 inputselector: fix cached buffer leak in chain function
gst_selector_pad_chain() was popping cached buffers out of the queue without
freeing those. Make sure we don't steal the GstBuffer as the cached buffer ref
has been passed to the pad chain function.

This can be reproduced by running the
validate.file.playback.switch_subtitle_track_while_paused.test5_mkv scenario
with Valgrind.

https://bugzilla.gnome.org/show_bug.cgi?id=747611

Signed-off-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
2015-04-10 09:27:30 -03:00
Jan Alexander Steffens (heftig)
27644a6bd2 input-selector: Rename _activate_sinkpad to _get_active_sinkpad
Removes the now unused 'pad' parameter and renames the function
to something more appropriate.

https://bugzilla.gnome.org/show_bug.cgi?id=739620
2015-03-24 10:34:27 -03:00
Jan Alexander Steffens (heftig)
bf8a71104c input-selector: Remove pad's 'active' field
This is now never read.

https://bugzilla.gnome.org/show_bug.cgi?id=739620
2015-03-24 10:34:27 -03:00
Jan Alexander Steffens (heftig)
6f24f4917d input-selector: Use segment-presence for running_time check
When determining whether the running_time of a pad can be
calculated, check if the segment is in TIME format instead
of using the 'active' field.

Since the latter is set through *any* activity, it's not a
reliable indicator of segment presence.

https://bugzilla.gnome.org/show_bug.cgi?id=739620
2015-03-24 10:34:27 -03:00
Jan Alexander Steffens (heftig)
0a3ded1932 input-selector: Remove 'blocked' flag
With the disappearance of the 'block' signal, this
flag cannot be set to TRUE.

gst_input_selector_wait disappears as it never waits
and just returns self->flushing.

https://bugzilla.gnome.org/show_bug.cgi?id=736891
2015-03-24 09:42:14 -03:00
Jan Alexander Steffens (heftig)
7a1ebbe0e3 input-selector: Remove obsolete 'block' signal
This signal blocks the input-selector with no means of unblocking
other than a state change back to READY. It seems this signal was
part of an old way of synchronously switching the selector,
together with the already-removed 'switch' signal.

Removing the signal is safe, as attempting to use it could only
end in deadlocks. Attempting to emit an unknown signal just causes
g_criticals.

https://bugzilla.gnome.org/show_bug.cgi?id=736891
2015-03-24 09:42:14 -03:00
Jan Alexander Steffens (heftig)
ce663311e1 input-selector: Fix waiting on EOS
This apparently got broken by bc1ec4e. Since self->blocked is always
FALSE, gst_input_selector_wait never actually waits.

Using (!self->eos || self->blocked) && ... as the loop condition would
be incorrect as well, because then the other call to the function in
_chain would block until EOS, so the functions cannot be merged trivially.

Since blocking is obsolete, gst_input_selector_wait will get removed anyway.
As such, just inline the loop.

https://bugzilla.gnome.org/show_bug.cgi?id=746518
2015-03-24 09:28:44 -03:00
Arun Raghavan
49a4951a0c input-selector: Drop custom latency query handling
The default latency query handler now implements this logic
2015-02-27 00:49:06 +05:30
Sebastian Dröge
66e8d3b9a0 inputselector: Use a separate query for upstream pads and let it fail if one upstream query fails 2015-02-19 01:16:52 +02:00
Sebastian Dröge
29d8b9df8b inputselector: Don't dereference NULL pointer
CID 1262286
2015-01-12 16:03:31 +01:00
Tim-Philipp Müller
3390b70d78 inputselector: fix silly GQueue iteration code
Not active by default though.
2015-01-05 00:22:11 +00:00
Sebastian Dröge
bc1ec4ec5f inputselector: Use the same waiting function for EOS and non-EOS waiting 2014-12-24 13:46:28 +01:00
Sebastian Dröge
a1c183417f inputselector: Wake up all waitings pads directly if we forward the EOS event
Otherwise they might wait a bit longer unnecessarily.

Also do some minor cleanup.
2014-12-24 13:44:09 +01:00
Song Bing
11e4b744f5 inputselector: Block when receiving an EOS event on a deactivated pad
... and only unblock when either a) the pad becomes active and the event
should be forwarded or b) the active pad went EOS itself.

Otherwise it can happen that we switch from a longer track that is not EOS yet
to a shorter track that already is EOS, but the shorter track won't have any
possibility to send its EOS event downstream anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=740949
2014-12-24 13:33:12 +01:00
Sebastian Dröge
12a905929f inputselector: Keep a ref of the currently active sinkpad around
Otherwise we can't be sure that the pointer points to a still existing
pad instance after releasing the lock.
2014-12-23 12:54:50 +01:00
Song Bing
3137043c3a inputselector: Get the active sinkpad again after taking the lock when handling events
It might have changed in the meantime.

https://bugzilla.gnome.org/show_bug.cgi?id=741893
2014-12-23 12:53:58 +01:00
Sebastian Dröge
154eefecc9 Don't compare booleans for equality to TRUE and FALSE
TRUE is 1, but every other non-zero value is also considered true. Comparing
for equality with TRUE would only consider 1 but not the others.

Also normalize booleans in a few places.
2014-12-01 09:51:37 +01:00
Tim-Philipp Müller
64a0abb0f4 inputselector: fix compilation 2014-10-03 14:04:58 +01:00
Stefan Sauer
e3dc7366bd input-selector: extract some common code into helpers 2014-10-03 14:44:48 +02:00
Stefan Sauer
8285002693 input-selector: small code cleanups
Rename TIMESTAMP -> PTS. Move a var down to the scope where it is used. Use
g_queue_free_full().
2014-10-03 14:22:01 +02:00
Stefan Sauer
d8bee3c769 inputselector: fix printf format
The padcount is uint. Also add comments to the instance vars.
2014-10-03 13:47:42 +02:00
Tim-Philipp Müller
49c6f923de coreelements: mark properties with MUTABLE_PLAYING 2014-09-14 16:08:07 +01:00
Thiago Santos
3001f3b433 inputselector: always proxy caps query
Otherwise it would only be proxied for the active pad which can lead
upstream to use an incompatible caps for the downstream element.

Even if a reconfigure event is sent upstream when the pad is activated, this
will save the caps reconfiguration if it is already using an acceptable caps.
2014-08-14 19:16:43 -03:00
Jan Schmidt
a89789366f input-selector: Hold pad object lock when changing tags
Avoid spurious crashes when tags are retrieved just as
new ones arrive.
2014-04-11 22:39:36 +10:00
Thiago Santos
e06f9667b0 inputselector: fix build with debug cached buffers enabled
gstinputselector.c:818:5: error: format not a string literal
and no format arguments [-Werror=format-security]
2014-04-03 18:17:03 -03:00
Thiago Santos
1d87a5244c inputselector: removing duplicate field position
It is already stored inside the GstSegment struct and
was only duplicating information. Also removed some
weird positon if/else that would possibly change the
segment that was going to be pushed downstream
2014-01-15 19:28:01 -03:00
Thiago Santos
5bb45ffbfc inputselector: handle gap events
Use gap events to advance the selector's pad position.

This is relevant to keep sync_streams mode working when one of the
streams doesn't have data all the time.
2013-11-29 15:03:44 -03:00
Arnaud Vrac
9bc26c5f25 input-selector: Fix missing pad activation notification
A new active pad might not be notified in some cases, which results
in the current track number not being set in playbin.

The active-pad notification is only sent in the chain and sink_event
functions, and only when the buffer or event that triggered the active
pad selection is from the newly activated pad. So in the other case
the notification will never be sent.

https://bugzilla.gnome.org/show_bug.cgi?id=704691
2013-07-23 08:59:07 +02:00
Sebastian Dröge
eaf333248a inputselector: Don't push new stream-start events on stream change unless they all have group ids
https://bugzilla.gnome.org/show_bug.cgi?id=704408
2013-07-22 15:30:10 +02:00
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
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
1d40478014 inputselector: Forward all sticky events, including stream-start 2013-05-09 12:15:48 +02: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
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
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
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
Edward Hervey
d3ffa82639 Remove 0.10-related documentation and "Since" markers 2012-07-10 12:03:27 +02:00
Tim-Philipp Müller
31976c426e inputselector: remove some dead code for old GLib versions 2012-06-26 17:30:19 +01:00