Commit graph

4564 commits

Author SHA1 Message Date
Edward Hervey aa10e82257 typefind: Avoid overflow calculation (image/quicktime)
The qt typefinder uses guint64 values for offset and size calculation
but the typefinder system only supports gint64 values.

Make sure we don't end up using potentially overflowing values.
2017-12-08 09:12:33 +01:00
Edward Hervey 1df9b05f18 typefind: Avoid overflow calculation
The qt typefinder uses guint64 values for offset and size calculation
but the typefinder system only supports gint64 values.

Make sure we don't end up using potentially overflowing values.
2017-12-08 08:05:10 +01:00
Edward Hervey 32eae2b166 typefind: Fix previous commit
We need to make sure we have *enough* data to read (including the
next 4 bytes)
2017-12-07 16:10:22 +01:00
Edward Hervey b1c135aa72 typefind: Optimize qt/3gp typefinding
Request the whole 'ftyp' atom data and scan within it. Avoids doing
a lot of small 4 byte pull from upstream if it's invalid.
2017-12-07 15:05:07 +01:00
Edward Hervey 0428b4afda typefind: wavpack: limit search in blocksize
The maximum blocksize is 131072 bytes, anything bigger is a corrupted
file.
2017-12-07 15:05:07 +01:00
Edward Hervey a3bf3094d1 typefind: Fix ico out-of-bound read
The furthest we go to verify the data is reading a guint32 at offset
18, therefore make sure we can read as much.
2017-12-07 11:04:50 +01:00
Jun Xie f88b20397f decodebin: Fix typo in docs
https://bugzilla.gnome.org/show_bug.cgi?id=791058
2017-12-01 10:03:40 +02:00
Edward Hervey f2f87d220f urisourcebin: Don't leak mutexes 2017-11-25 12:45:03 +01:00
Edward Hervey a47881100d videotestsrc: Avoid overflow calculation
n_frames could end up being quite big (potentially up to G_MAXINT64). Which
would result in overflowing 64bits when multiplying it by GST_SECOND.

Instead move GST_SECOND to the num argument
2017-11-21 10:15:02 +01:00
Edward Hervey 38c835ec1e decodebin2: Don't spawn threads on shutdown
If we are shutting down, don't spawn a cleanup thread to cleanup old
groups and instead queue them to be cleaned up in the state change
thread.

This avoids (hopefully for good) having a race between the state change
thread and other threads trying to deactivate elements/pads.
2017-11-16 18:22:20 +01:00
Edward Hervey e72aa501b0 decodebin2: Avoid deactivation races
Deactivating pads from two threads isn't 100% MT-safe. There is a
slim chance that the GstPadActivateFunc might be called twice with
the same values (in this case from the cleanup thread *and* from
the GstElement change_state function when going from PAUSED to READY).

In order to avoid that, call any existing cleanup function *before*
calling the parent change_state implementation on downwards state
changes.
2017-11-16 06:44:10 +01:00
Edward Hervey ce8f51e30e decodebin2: Don't try to add pads when shutting down
Be even more agressive than before and just hold the DYN lock when/if
adding pads and return if we are shutting down.
2017-11-14 13:40:50 +01:00
Edward Hervey 77e5a71a15 decodebin2: Don't take locks when deactivating pads
When deactivating pads, we need to ensure that the streaming threads
going through the pads we wish to deactivate can cleanly return.
Failure to do that would result in the streaming locks of those
pads never being released. The end result would be a deadlock
when stopping decodebin2.

In order to avoid that situation, release the "dyn" lock around
the deactivation code. And refactor the code to cope with the
list of blocked pads having potentially changed when re-acquiring
the lock.
2017-11-14 13:40:48 +01:00
Edward Hervey 6280547be7 playbin3: Remove unneeded blacklisting
Blacklisted mimetypes have been empty in almost 10 years ...
2017-11-10 17:22:36 +01:00
Edward Hervey cd508aff97 playbin3: Remove context caching
This is now handled by the GstBin baseclass
2017-11-10 17:22:22 +01:00
Edward Hervey 3dd0888d1e playbin3: Remove source property
And instead use the "setup-source" signal. This opens the way to deal
with more than one 'source' for a given playlist entry
2017-11-10 17:06:46 +01:00
Edward Hervey 35a8d42724 parsebin: Don't let thread run after unref
We have a dedicated one-shot thread to handle cleanup of old groups.

While this is a good idea. It's an even better idea to make sure
that thread is *completed* before the parsebin element to which
it is related isn't freed/gone.

* There can only be one cleanup thread happening at any point in time.
  If there is already one, we wait for the previous one to finish.
* When shutting down (NULL=>READY) make sure the thread is finished

https://bugzilla.gnome.org/show_bug.cgi?id=790007
2017-11-10 17:06:45 +01:00
Edward Hervey 43b9bcbddb decodebin2: Don't let thread run after unref
We have a dedicated one-shot thread to handle cleanup of old groups.

While this is a good idea. It's an even better idea to make sure
that thread is *completed* before the decodebin2 element to which
it is related isn't freed/gone.

* There can only be one cleanup thread happening at any point in time.
  If there is already one, we wait for the previous one to finish.
* When shutting down (NULL=>READY) make sure the thread is finished

https://bugzilla.gnome.org/show_bug.cgi?id=790007
2017-11-10 17:06:10 +01:00
Edward Hervey d53ccfd8e5 parsebin: Check for shutdown before exposing pads
We already checked previously, but we need to do it before adding
pads.
2017-11-10 17:06:10 +01:00
Edward Hervey 92e8876844 parsebin: Emit 'drained' only for the top-level chain
Instead of emitting 'drained' whenever every single chain is drained
(which would result in plenty of signal emission, and would also
occur when switching groups), only emit it when the top-level chain
is drained.

Furthermore, mark unknown (and therefore unexposed) pads as drained
since we'll never get EOS on them.

https://bugzilla.gnome.org/show_bug.cgi?id=787367
2017-11-10 10:05:26 +01:00
shakin chou 2ec51ef998 playbin: Don't ref_sink() the sinks twice
Since we're already sunk floating reference, we shouldn't call ref_sink
again, which increases the ref_count and cause leaks.

https://bugzilla.gnome.org/show_bug.cgi?id=789547
2017-11-07 10:32:34 +02:00
Edward Hervey c81e3e6fce videotestsrc: Fix undefined left shift
Cast value to target type
2017-11-04 12:19:46 +01:00
Edward Hervey a23d4d1c1f typefind: Fix out-of-bound read in PNM typefinder 2017-11-02 17:59:29 +01:00
Tim-Philipp Müller 6c749f75a5 typefindfunctions: fix off-by-one in webvtt typefinder
We're also checking the byte after the WEBVTT magic.
2017-11-02 09:05:47 +00:00
Edward Hervey f448cecceb decodebin2: Recheck shutdown behaviour in error case
If we can expose the main chain, recheck whether we are shutting
down or not.

decodebin2 might have been set to READY/NULL during the attempt
to expose, which would cause it to fail ... but it is not a fatal
issue.
2017-11-02 07:55:16 +01:00
Edward Hervey cb0b73672c Update disted orc file
For latest orc fixes
2017-10-31 11:57:23 +01:00
Edward Hervey 5bcc1e2b57 typefind: Use GST_READ_UINT32 macros
Avoids undefined behaviour with shifting
2017-10-30 11:10:11 +01:00
Edward Hervey 7b5d97e9c3 typefind: Fix out-of-bound memory access
We were not checking the proper amount of available data in several
places
2017-10-30 08:57:19 +01:00
Vivia Nikolaidou b2be4169ee audioconvert: Fix empty mix matrix documentation typo 2017-10-27 18:29:40 +03:00
Seungha Yang 466cbef6ab decodebin3: Allow configure output stream without reassign slot
By select-streams event, current implementation of decodebin3
supports deactivate output stream (i.e., decoder element)
in reassign slot(), but cannot activate any slot without track change.

https://bugzilla.gnome.org/show_bug.cgi?id=778015
2017-10-27 09:55:59 +02:00
Seungha Yang 969ab3f48c playbin3: Use STREAMS_SELECTED message to update selected stream types
Application might choose only specific type among all available types
using select-streams event. In this case, it is desired that reconfigure
of playsink to clear unused stream path.

https://bugzilla.gnome.org/show_bug.cgi?id=778015
2017-10-27 09:55:59 +02:00
Mathieu Duponchelle b0c184e189 audioconvert: document passing an empty mix-matrix 2017-10-26 18:05:46 +02:00
Mathieu Duponchelle d4db88772b audioconvert: allow empty mix matrix
When an empty mix matrix is passed, audio-channel-mixer
will now generate a (potentially truncated) identity matrix,
this replicates the behaviour of audiomixmatrix in first-channels
mode.

https://bugzilla.gnome.org/show_bug.cgi?id=788833
2017-10-11 22:57:38 +02:00
Reynaldo H. Verdejo Pinochet e81c334ca9 Use proper GtkDoc notation for NULL/FALSE/TRUE 2017-10-03 14:31:18 -07:00
Mathieu Duponchelle 8d52a107a4 audioconvert: [API]: expose mix-matrix property.
This obsoletes audiomixmatrix

https://bugzilla.gnome.org/show_bug.cgi?id=785471
2017-09-22 20:17:48 +02:00
Mathieu Duponchelle 7a407b69e1 audioconvert: refactor format removal.
remove_format_info was a bit confusing to read, this removes
it in favor of standard gst_caps_map_in_place calls.

This no longer simplifies the resulting caps, but I
consider this should be the job of basetransform.

https://bugzilla.gnome.org/show_bug.cgi?id=785471
2017-09-22 15:03:41 +02:00
Mark Nauwelaerts 2372894c63 playbin: ref_sink() sink rather than pointer to sink 2017-08-20 12:25:29 +02:00
Edward Hervey ce65017d03 decodebin3/urisourcebin: Switch to actual EOS events internally
Use the intended sequence for re-using elements:
* EOS
* STREAM_START if element is to be re-used

This avoids having elements (such as queue/multiqueue/queue2) not
properly resetting themselves.

When delaying EOS propagation (because we want to wait until all
streams of a group are done for example), we re-trigger them by
first sending the cached STREAM_START and then EOS (which will
cause elements to re-set themselves if needed and accept new
buffers/events).

https://bugzilla.gnome.org/show_bug.cgi?id=785951
2017-08-11 11:23:29 +03:00
Sebastian Dröge b4899a5a65 playbin: Make sure to ref_sink() any sinks before calling activate_sink()
It is forwarding messages to the playbin bus, thus forwarding messages
that contain a floating reference to the application. This generally
makes bindings unhappy, we must not leak floating references to them.
2017-08-07 15:27:45 +03:00
Thibault Saunier ffd4c990c1 audioconvert: Consider channel=1, channel-mask=0x0 as mono
channels=1 is always mono, having it 'unpositioned' does not make
sense.

This fixes pipeline such as:

  gst-validate-1.0 audiotestsrc ! audio/x-raw,channels=2,rate=44100,layout=interleaved ! audioconvert ! audioresample ! audio/x-raw, rate=44100, channels=1 ! avenc_mp2 ! fakesink

https://bugzilla.gnome.org/show_bug.cgi?id=785407
2017-07-26 09:26:39 -04:00
Satya Prakash Gupta 075dac486f ssaparse: Fix buffer leak in error case
https://bugzilla.gnome.org/show_bug.cgi?id=785331
2017-07-24 11:56:50 +03:00
Stefan Sauer 2bf83de168 adder: comment and formatting cleanups
Log a few more details. Update method comments. Remove some extra blank lines.
2017-07-23 13:13:14 +02:00
Mathieu Duponchelle 875af55937 videorate: flush remaining buffers on SEGMENT_DONE
Just as we do on EOS.

https://bugzilla.gnome.org/show_bug.cgi?id=784666
2017-07-21 14:22:07 -04:00
Seungha Yang bf32c0b3b0 decodebin3: Remove FIXME and do remove_input_stream() only for the corresponding parsebin
Do not remove other parsebin's input streams. It will cause unexpected
removal of any input streams in multi-parsebin use case.

Basically, the purpose of blocking buffers is similar to checking
no-more-pads of chain/group. That is, it gives hint to know the timing
to remove old (EOSed) streams of the parsebin and to add/reuse slots
for new input streams. But, that doesn't mean that we need to remove
other parsebin's EOSed stream. Each parsebin has most likely its
own streaming thread and therefore EOSed time can be much different.
(i.e., much early EOS of subtitle only parsebin)

https://bugzilla.gnome.org/show_bug.cgi?id=785120
2017-07-19 17:13:20 +02:00
Seungha Yang abe1183c17 parsebin: Ensure StreamType and Caps of GstStream object before exposing it
The final StreamType and Caps might not be set yet on GstStream at exposing the pads.

https://bugzilla.gnome.org/show_bug.cgi?id=785120
2017-07-19 17:13:20 +02:00
Seungha Yang 7a236e2302 playbin3: Delay linking text output until video stream is shown
We are not sure that which stream's collection arrives first
when there are multiple parsebins such as adaptive streaming.

https://bugzilla.gnome.org/show_bug.cgi?id=785120
2017-07-19 17:13:20 +02:00
Satya Prakash Gupta 3cc824c9ce encodebin: fix possible pad ref leak in error code path
https://bugzilla.gnome.org/show_bug.cgi?id=785065
2017-07-19 09:07:27 +01:00
Edward Hervey 6ccba23752 playbin3: We only care about source pads going away 2017-07-18 13:05:06 +02:00
Edward Hervey 651a0fe312 decodebin3: use lock macro where applicable 2017-07-18 13:05:06 +02:00
Thibault Saunier 4b3798fedc decodebin3: Protect fields related to streams handling with the SELECTION_LOCK
Fields related to stream handling (input_streams,
output_streams, slots, guint slot_id) where used totally unprotected
until know.

This lead to several races, especially playing back RTSP streams.

To protect those fields, the OBJECT_LOCK can not be used as we sometimes
need to be able to post message on the bus while holding it.

decodebin3 already has a lock to manage stream selection, and in the end
it makes sense to protect all the stream management fields with the same
lock which is why we reuse the SELECTION_LOCK here.

https://bugzilla.gnome.org/show_bug.cgi?id=784012
2017-07-18 13:05:06 +02:00