Thomas Guillem [Tue, 20 Jan 2015 09:46:31 +0000 (10:46 +0100)]
libvlc: add libvlc_MediaListEndReached event
Expose an event to libvlc users which allows them to get notified when a media
list reached the end. That is, when the media list is attached to a media
(subitems) that completed a parsing. Or when the media list is attached to a
media discovery that stopped.
Thomas Guillem [Tue, 20 Jan 2015 09:46:29 +0000 (10:46 +0100)]
libvlc: media: fix leak if it has subitems
Don't call libvlc_media_list_set_media from media since it causes
p_md->p_subitems to retain p_md while p_md is already retaining
p_md->p_subitems, therefore these 2 objects won't be releasable.
Add a new internal variable: p_internal_md that is set from media without
retaining it.
Thomas Guillem [Mon, 19 Jan 2015 10:22:48 +0000 (11:22 +0100)]
libvlc: libvlc_media_subitems: lock and always return a medialist
This way, libvlc_media_subitems can be called before, during or after a
parsing. Furthermore, this allows to attach media_list events before
libvlc_media_parse is called.
Julian Scheel [Mon, 19 Jan 2015 10:30:33 +0000 (11:30 +0100)]
mmal/codec: Enable error_concealment for h264
Until now error concealment was disabled for h264 decoding because the mmal
h264 decoder did not properly parse SEI so that depending on the stream it
could happen that no valid picture would be detected at all and therefore no
picture would be shown at all. Latest raspberry firmware fixed this, so that
error concealment works properly and can be enabled.
Julian Scheel [Mon, 19 Jan 2015 10:30:32 +0000 (11:30 +0100)]
mmal/vout: Make display() synchronous
Ensure that the pictures which are rendered by display() are released before
display() returns. This is required to ensure that on stop all pictures are
released and the core can safely cleanup the pool. Without this the core
might detect pictures as leaks and free them on its own. Once this happens
we're running straight into a double free.
Julian Scheel [Mon, 19 Jan 2015 10:30:31 +0000 (11:30 +0100)]
mmal/deinterlace: Implement filter flush
It is required to flush the filter properly for stopping of playback to work
reliably. Without flushing the code might detect pictures currently held in
the filter as lost which will lead to double frees later on.
Julian Scheel [Mon, 19 Jan 2015 10:30:30 +0000 (11:30 +0100)]
mmal/deinterlace: Add locking to port callbacks
The in- and ouput port callbacks lead to access on the mmal pools, which are
not thread-safe. To deal with this the sys->mutex is used to lock against
usage of the mmal pools from the main thread.
Julian Scheel [Mon, 19 Jan 2015 10:30:29 +0000 (11:30 +0100)]
mmal: Restore old buffer configuration
With previours cleanups we reduced the number of allocated mmal buffers and
buffer headers. This caused some issues as the mmal components had to wait for
buffers frequently, which slowed them down. To avoid framedrops and even
picture stalls revert to the old buffer configuration, which wastes a bit
memory in theory but works way more reliably and smoothly.
Julian Scheel [Mon, 19 Jan 2015 10:30:28 +0000 (11:30 +0100)]
mmal/vout: Use cached framerate for phase adjust
The framerate stored in vd->source is not reliable in any case. Instead we use
the internally cached framerate which is updated from the actual pictures
which are rendered.
Julian Scheel [Mon, 19 Jan 2015 10:30:27 +0000 (11:30 +0100)]
mmal/deinterlace: Explicitly count buffers in transit
The previous approach of calculating the buffers in transit was broken because
it assumed that buffers which were currently processed in the video output
stage are in transit. In fact only those buffers which are currently handed
off to the mmal output port of the filter plugin are to be counted as buffers
in transit. Fixing this avoids some framedrops due to missing/late buffers.
Julian Scheel [Mon, 19 Jan 2015 10:30:26 +0000 (11:30 +0100)]
mmal/codec: Explicitly count buffers in transit
The previous approach of calculating the buffers in transit was broken because
it assumed that buffers which were currently processed in the video output
stage are in transit. In fact only those buffers which are currently handed
off to the mmal output port of the video_decode plugin are to be counted as
buffers in transit. Fixing this avoids some framedrops due to missing/late
buffers.
Julian Scheel [Mon, 19 Jan 2015 10:30:25 +0000 (11:30 +0100)]
mmal/codec: Remove buffer header count hack
This hack is not required anymore as the buffer header lifecycle is properly
handled now. This ensures that the codec only sees buffers which are ready for
reuse and avoids some misbehaviour of the codec.
Julian Scheel [Mon, 19 Jan 2015 10:30:24 +0000 (11:30 +0100)]
mmal/codec: Flush the decoder when running out of buffers
Normally the decoder should not run out of input buffers as it is fed with
packetized data and for each input block a picture shall be generated. In rare
situations the decoder seems to fail internally and does stop generating
pictures. In this case the input buffers are not released either. If this
happens the whole pipeline stalls and vlc buffers input data until system runs
out of memory. To avoid this error case force the decoder to flush its port
if it runs out of input buffers. This causes a short image distortion but the
decoder won't block anymore.
Julian Scheel [Mon, 19 Jan 2015 10:30:23 +0000 (11:30 +0100)]
mmal: Replace global mutex by module-owned mutex
The mutex held within mmal_pictures is used to lock access of mmal
picture/buffer pools between vlc main thread and mmal callback threads. This
is only required to be locked per pool and not globally for all mmal modules.
Thus using a global mutex caused a slight performance hit when using mmal vout
and deinterlace simultaneously which operate on independent picture pools. Now
the pool owner provides the mutex handle when allocating the pictures, so
that independent locking can be used.
Julian Scheel [Mon, 19 Jan 2015 10:30:21 +0000 (11:30 +0100)]
mmal/codec: Read opaque handle from picture_sys
Instead of assuming that p_pixels[0] points to the mmal opaque handle retrieve
it from the picture_sys structure. Using p_pixels for the pointer was broken
due to vlc core copying p_pixels only for formats with actual data.
Matthias Treydte [Mon, 19 Jan 2015 15:24:57 +0000 (16:24 +0100)]
wayland/shell: Fix race for wnd->display.wl.
The Wayland background thread dereferences said variable, but is started
before the value is written there. Occasionally the thread would win
the race and segfault in wl_display_get_fd.
libvlc: fix vbi-page initialization without zvbi plugin
A variable cannot be inherited if it is not a configuration item.
Note this only avoids generating an error; VBI cannot work without the
plugin anyway.
Thomas Guillem [Thu, 8 Jan 2015 16:10:00 +0000 (16:10 +0000)]
lib: change libvlc_media_discoverer_t creation
libvlc_media_discoverer_new_from_name was creating a services_discovery_t and
was starting it, so libvlc_MediaDiscovererStarted event (or any other events)
could not be received.
To fix that, Split libvlc_media_discoverer_new_from_name into
libvlc_media_discoverer_new and libvlc_media_discoverer_start. That way, we can
attach events between create and start.
libvlc_media_discoverer_new_from_name is now deprecated, but it still works
like before.