Commit graph

16185 commits

Author SHA1 Message Date
Thibault Saunier a37f4eeff8 audio: Add missing G_BEGIN/END_DECLS 2017-12-01 10:15:56 -03: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 c3875a236b alsamidisrc: Don't assume a clock has been set
Can happen in testing scenarios for example
2017-11-30 10:47:12 +01:00
Thiago Santos 17e1e308a3 codec-utils: add some missing gi annotations
Missing some array and out parameters annotations

https://bugzilla.gnome.org/show_bug.cgi?id=790950
2017-11-30 01:24:14 -08:00
Antonio Ospite feacb875a4 alsamidisrc: Improve buffer timestamping
Make buffer timestamps more accurate and, more importantly, actually
representative of the MIDI events timing.

Previously, buffers were only sent with timetamps aligned at a 10ms
boundary which was just wrong, now the buffer timestamp represents the
real time of the MIDI event.

Conveniently, the ALSA sequencer API supports scheduling events in the
future so the sequencer infrastructure can be used to have the tick
delivered at the right time, avoiding any custom scheduling mechanism.

The ticks scheduling starts on the first transition to PLAYING, and the
delay is also calculated when the pipeline goes into PLAYING.

https://bugzilla.gnome.org/show_bug.cgi?id=787683
2017-11-29 21:13:38 -05:00
Antonio Ospite 3a64ed723a alsamidisrc: Expand snd_seq_create_simple_port() and use a queue for timestamps
Events are timestamped with a real-time value representing the time
passed since the queue timer was started.

The timestamp is not used just yet.

https://bugzilla.gnome.org/show_bug.cgi?id=787683
2017-11-29 21:13:38 -05:00
Antonio Ospite 132ead36c1 alsamidisrc: Merge prepare_buffer() and push_buffer()
The separation is not very useful since push_buffer() is the only user
of prepare_buffer().

https://bugzilla.gnome.org/show_bug.cgi?id=787683
2017-11-29 21:13:38 -05:00
Antonio Ospite b5060f16d9 alsamidisrc: Don't set buffer offset and duration
They are not relly needed for a live source.

https://bugzilla.gnome.org/show_bug.cgi?id=787683
2017-11-29 21:13:38 -05:00
Antonio Ospite 3c5aa0a786 alsamidisrc: Fix a memory leak when setting the "ports" property
When setting the "ports" property the value is duplicated but it's not
freed when the elements stops.

Reported by Valgrind (example run with "alsamidisrc ports=128:0"):

  6 bytes in 1 blocks are definitely lost in loss record 30 of 1,911
     at 0x4C2BBEF: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
     by 0x5411528: g_malloc (gmem.c:94)
     by 0x542A9FE: g_strdup (gstrfuncs.c:363)
     by 0x775211E: gst_alsa_midi_src_set_property (gstalsamidisrc.c:284)
     by 0x5184A4D: object_set_property (gobject.c:1439)
     by 0x5184A4D: g_object_setv (gobject.c:2245)
     by 0x51859DD: g_object_set_property (gobject.c:2529)
     by 0x4F0474C: ??? (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1203.0)
     by 0x4F065C8: ??? (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1203.0)
     by 0x4F07557: ??? (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1203.0)
     by 0x4EFE3EE: gst_parse_launch_full (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1203.0)
     by 0x4EFE673: gst_parse_launchv_full (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1203.0)

https://bugzilla.gnome.org/show_bug.cgi?id=787683
2017-11-29 21:13:38 -05:00
Antonio Ospite f671026f11 alsamidisrc: Prevent Valgrind from reporting cached config as memory leaks
See http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=MEMORY-LEAK;hb=HEAD

This allows to have cleaner Valgrind reports about alsamidisrc and make
it easier to spot actual problems.

https://bugzilla.gnome.org/show_bug.cgi?id=787683
2017-11-29 21:13:38 -05:00
Antonio Ospite 8638d81eb3 alsamidisrc: Improve a comment and remove one trailing space
https://bugzilla.gnome.org/show_bug.cgi?id=787683
2017-11-29 21:13:38 -05:00
Julien Isorce 8af7b1f70b appsink: fix end condition of query drain handler
The while loop should end when all buffers "and" the preroll
buffer are consumed but this means to continue waiting if there
are still some pending buffers "or" preroll buffer.

The unit test was correct but racy because of this mistake.
I.e. because of the wrong "and" the while could finish too early.

cd tests/check && GST_CHECKS=test_query_drain make elements/appsink.forever

https://bugzilla.gnome.org/show_bug.cgi?id=789763
2017-11-29 15:09:04 +00:00
Matthew Waters 3300584e96 Automatic update of common submodule
From 3f4aa96 to e8c7a71
2017-11-27 20:10:15 +11:00
Tim-Philipp Müller 1a912f918b win32: remove .def file with exports
They're no longer needed, symbol exporting is now explicit
via GST_EXPORT in all cases (autotools, meson, incl. MSVC).
2017-11-26 18:36:35 +00:00
Tim-Philipp Müller a02b0f7b05 autotools: stop controlling symbol visibility with -export-symbols-regex
Instead, use -fvisibility=hidden and explicit exports via GST_EXPORT.
This should result in consistent behaviour for the autotools and
Meson builds.
2017-11-26 18:30:57 +00:00
Tim-Philipp Müller 4bfba1dcda video: add missing GST_EXPORT 2017-11-26 18:14:39 +00: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
Sebastian Dröge d33c407f6b rtp: Require gconstpointer instead of gpointer for gst_rt[c]p_buffer_new_copy_data() 2017-11-17 14:14:55 +02: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 4c2f91d69e discoverer: Don't remove element when switching to PLAYING
There is a race going on somewhere when we attempt to remove elements
*while* the parent container is switching to PLAYING.

In order to avoid this issue with discoverer, make sure we never
remove elements while switching to PLAYING.
2017-11-15 10:55:56 +01:00
Edward Hervey 9c4b3b1ee7 discoverer: Don't add pads/elements when cleaning up
There is no need to add more pads/elements since we are already done.
2017-11-15 10:55:55 +01:00
Edward Hervey 4636b8dd6f discoverer: Remove probe when done 2017-11-15 10:55:55 +01:00
Edward Hervey 51eeb4534a ogmparse: Set caps after sending pending events
Avoids sending STREAM_START before CAPS
2017-11-15 10:55:55 +01:00
Edward Hervey 6c6d8b0b95 oggstream: Demote error to warning 2017-11-15 10:55:55 +01:00
Edward Hervey 25fa4802fe oggdemux: Move mutex/cond initialization/release
We only need to initialize the mutex/cond once when creating the
element and then release them when we are done with the element.

Avoids weird "mutex_clear called when still locked" issues
2017-11-15 10:55:55 +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 c7917df7e2 theoradec: Handle negotiation failure
Avoids a trove of random issues afterwards (due to decoder not
*actually* being initialized/negotiated).
2017-11-11 07:47:52 +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
Sebastian Dröge b9aaa7f4f2 audiobasesink: Print signed time offset as a signed number 2017-11-08 19:24:55 +02:00
Sebastian Dröge 9bbcccc21e audiostreamalign: Add G_BEGIN_DECLS/G_END_DECLS 2017-11-08 19:24:55 +02:00
Edward Hervey 895d884701 oggdemux: Solidify gst_ogg_demux_loop_push() some more
There were still some races going on where seeking events wouldn't
be properly intercepted/executed by this thread.

* Instead of always waiting for the GCond to be emitted, first just
  check if there is an event available
* Take ownership of the event *while* the lock is taken and not
  after releasing/reacquiring it
* Finally acquire lock at the very top and release it at the end
  to make it a bit more streamlined

This removes the remaining issues with seeks not being executed
2017-11-08 17:51:52 +01:00
Edward Hervey 9f678bb27f oggdemux: Don't double-unlock
The previous branch will release the lock in the call to
gst_ogg_demux_seek_back_after_push_duration_check_unlock()

Only unlock it if we didn't call that function
2017-11-08 17:51:51 +01:00
Edward Hervey c86df789ed oggdemux: Drop data before new segment
When calculating duration in push-mode we seek to a certain position
and discard any data until we get data from that requested position.

The problem is that basing ourselves solely on offset to determine
whether we reached the target offset is wrong since the source might
be fast enough  to send us that target position *before* it processed
the requested seek.

This would end up in a situation where:
* We think we're done with duration estimate
* We fire a seek back to "0" in the loop thread
* We resume normal processing
* ... except that we're still getting data from too far ahead which
  we decide to process.
* And we start doing totally wrong granule/time/duration calculation
  and pushing wrong data.

Instead of this confusion, wait until we receive data from the requested
seek. We do that by using the fact that the seqnum in
seek_event_drop_til will be non-zero until the SEGMENT corresponding
to the requested SEEK has been received.

Bonus: makes startup slightly faster
2017-11-07 15:16:52 +01:00
Edward Hervey 0a49b93ade oggdemux: Wait for push loop to be started
Code using the push_loop_thread (using for sending seeks) assumes
that the thread was properly started, except that this isn't always
true and the thread might not have completely started.

Instead wait for the thread to properly start before doing anything
else.
2017-11-07 15:16:52 +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 5e373936bb oggstream: Ensure enough bytes for fishead header parsing 2017-11-06 14:29:26 +01:00
Edward Hervey af48682d44 oggstream: Use proper type for sample calculation
If we are going to return a (potentially) 64bit integer, don't use
a 32bit one for calculation, otherwise we could end up exceeding
the maximum size of a 32bit int.
2017-11-05 12:16:13 +01:00
Edward Hervey 7f5ffcaa49 oggstream: More fixes for invalid granuleshift
Don't use granuleshift if it wasn't set
2017-11-05 12:15:33 +01:00
Edward Hervey 89238f9de1 discoverer: Don't switch to PLAYING if we saw an error
If we saw an error on the bus, we can't be guaranteed that element will
function properly anyway. Avoids weird state change races also
2017-11-04 19:48:13 +01:00
Edward Hervey fcf09c18f2 Revert "discoverer: Avoid race of adding elements while stopping"
This reverts commit 9a8cb29970.

The problem is deeper down the stack
2017-11-04 19:09:19 +01:00
Edward Hervey ae865ec1d1 rtcpbuffer: fix left shift override
Needs to be cast to the target type
2017-11-04 16:56:10 +01:00