Commit graph

2694 commits

Author SHA1 Message Date
Edward Hervey 427df2d5d9 ogmparse: Make sure we set valid string on caps
the fourcc might not contain printable characters, use the convenience
macro to turn it into a printable fourcc, like it's done in
gstogmparse
2017-12-06 14:23:49 +01: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
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
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 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 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
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 2cf5d596ee oggstream: Fix default granuleshift usage
For stream mappers that don't set a specific granuleshift, it will
have the default value of -1.

Protect the code for that and return the granule value as-is
2017-11-04 11:50:13 +01:00
Edward Hervey 1172e5efc7 oggdemux: Protect against invalid granule positions
Only valid values are -1, 0 or positive values. Anything else is
most likely corrupted data streams
2017-11-04 11:50:10 +01:00
Edward Hervey 33dfed5af8 oggdemux: Only track time for initialized streams
in push-mode we only can track time (or most operations on streams
for that matter) if the underlying GstOggMap was properly initialized.
2017-11-01 18:39:26 +01:00
Edward Hervey c3006b17d1 oggstream: Add a default GstOggMap
Since the default value of a GstOggPad.map.map was 0 ... we would
end up using wrong functions from mappers() if the stream wasn't
initialized yet.

Instead of that, use a default blank/empty first entry.
2017-11-01 18:39:26 +01:00
Edward Hervey f1c44332d5 ogmparse: Ensure we don't create bogus fractions
The clamping of the fraction denominator was bogus (it needs to
be >0)
2017-11-01 11:19:58 +01:00
Edward Hervey eb8bf0f162 oggdemux: Fix chain leak in push mode
In some corner cases we end up with the building chain not being
properly tracked (and therefore not properly freed).

Add a FIXME so it can later be fixed, but for now just fix the leak
2017-11-01 11:18:12 +01:00
Edward Hervey 0297bc2a4f ogmparse: Error out if we can't figure out the format
In some cases we might not be able to figure out the fixed format
from the header.

Properly error out in those cases.
2017-11-01 10:32:54 +01:00
Edward Hervey e638f81165 ogg: Don't add tags to empty taglist 2017-10-31 11:57:19 +01:00
Edward Hervey 90106b6bf2 oggdemux: Don't forget to reacquire lock when needed
Fixup to ef93130cf0

I overlooked the issue. There is a case when the lock is released
and we need to reacquire it
2017-10-26 10:07:15 +02:00
Edward Hervey 6fd8d78d8b oggdemux: Don't drop sticky events
Previous commit was wrong. We should still send all events to the
pad (so that sticky events get attached to it and sent when pad
gets added).
2017-10-24 11:05:20 +02:00
Edward Hervey e8a60b3de9 oggdemux: Improve handling of EOS without source pads
We might have a chain to use, but it might not have any active pads

Properly detect that and send an error message on EOS
2017-10-24 10:56:00 +02:00
Edward Hervey f902286a26 oggdemux: Error out on EOS if we have no chains to use
There are not active and pending chains, if we get EOS we need to
inform the user via an error message
2017-10-20 18:41:52 +02:00
Edward Hervey ef93130cf0 oggdemux: Don't double lock
The lock was already taken just before this block and is released after
2017-10-20 18:41:46 +02:00
Mathieu Duponchelle 8598f08278 opusenc: Allow unpositioned channels.
The input will be treated as a set of mono channels,
and the channel-mapping-family will be set to 255
(no defined channel meaning)

https://bugzilla.gnome.org/show_bug.cgi?id=788720
2017-10-11 19:42:39 +02:00
Ponnam Srinivas 0e8a510eda alsasink: Fix Memory leak in payload not succuss case
https://bugzilla.gnome.org/show_bug.cgi?id=788114
2017-09-26 11:18:09 +03:00
Mark Nauwelaerts 20705f01fc textoverlay: ensure text buffer has writable metadata when modifying 2017-07-01 17:45:36 +02:00
Mark Nauwelaerts bd940e7126 textoverlay: adjust a valid text buffer duration to fall within segment
... as expected later on when end time is used to determine end running time.
Otherwise the latter is determined as NONE and the resulting text buffer is
then used indefinitely.
2017-07-01 17:44:22 +02:00
Mark Nauwelaerts 9c95303f3a textoverlay: make debug statement more informative 2017-07-01 17:16:33 +02:00
Thibault Saunier dd1e4f5ebb alsasrc: Handle newly added GstStateChange values
https://bugzilla.gnome.org/show_bug.cgi?id=783798
2017-06-20 09:19:53 -04:00
Tim-Philipp Müller e774d1ca4b meson: use dep.get_pkgconfig_variable()
instead of calling pkg-config ourselves.
2017-06-05 23:57:48 +01:00
Vincent Penquerc'h bb0abf8558 oggdemux: fix artifacts at chain boundaries
https://bugzilla.gnome.org/show_bug.cgi?id=782132
2017-05-29 16:22:04 +01:00
Edward Hervey 62df7fdaba pango: Handle failure to multiply fractions
And set PAR back to the default value of 1:1

CID #1409851
2017-05-26 18:02:12 +02:00
Vincent Penquerc'h 523e98396f oggdemux: fix clipping more samples than exist in the first packet
This can happen in Opus (and maybe other codecs ?), and would cause
failure to play.

https://bugzilla.gnome.org/show_bug.cgi?id=782157
2017-05-26 14:41:47 +01:00
Mark Nauwelaerts 6d6a6bc3d8 textoverlay: optionally scale text to ensure proper display text aspect ratio
... by prescaling with an inverse aspect scaling as applied by video scaling
2017-05-21 12:46:36 +02:00
vijay f460d7d184 alsa: Add mapping for PCM F32/F64 formats
Fix enables float pcm formats for both the alsasrc and alsasink

https://bugzilla.gnome.org/show_bug.cgi?id=782695
2017-05-17 10:33:52 -04:00
Nicolas Dufresne e0d793f793 alsasink: Accept MPEG 1 layer 3 version 2.5
https://bugzilla.gnome.org/show_bug.cgi?id=781929
2017-05-16 15:37:16 -04:00
Nicolas Dufresne 8e6c6266d7 Remove plugin specific static build option
Static and dynamic plugins now have the same interface. The standard
--enable-static/--enable-shared toggle are sufficient.
2017-05-16 13:42:07 -04:00
Vitor Massaru Iha c579a4298b textoverlay: Removing duplicated command.
gst-launch-1.0 was duplicated on textoverlay example.

https://bugzilla.gnome.org/show_bug.cgi?id=782018
2017-05-01 18:52:42 +01:00
Tim-Philipp Müller 4246198fb3 No need for newlines in debug log statements 2017-04-12 09:58:49 +01:00
Thibault Saunier 099ac9faf2 docs: Convert gtkdoc comments to markdown
Modernizing the documentation, making it simpler to read an
modify and allowing us to possibly switch to hotdoc in the
future.
2017-03-10 18:19:17 -03:00