gst-plugins-base: streamsplitter: Fix getcaps src pad caps merge

Stefan Kost ensonic at hora-obscura.de
Wed Jun 29 14:29:13 PDT 2011


On 06/29/11 02:59, Robert Swain wrote:
> Module: gst-plugins-base
> Branch: master
> Commit: dc79c424849133d4ee1687beff40e33d472f8919
> URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=dc79c424849133d4ee1687beff40e33d472f8919
>
> Author: Robert Swain <robert.swain at collabora.co.uk>
> Date:   Wed Jun 29 11:30:51 2011 +0200
>
> streamsplitter: Fix getcaps src pad caps merge
>
> Caps returned from gst_pad_peer_get_caps_reffed () may not be writable.
> If they are not is should cause an assertion in gst_caps_merge (),
> however, sometimes assertions are disabled in binary builds of -base and
> it's safer to just be sure the caps are writable. Also, check that the
> reffed caps pointer is not NULL.
>
> ---
>
>  gst/encoding/gststreamsplitter.c |    9 ++++++---
>  1 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/gst/encoding/gststreamsplitter.c b/gst/encoding/gststreamsplitter.c
> index c473386..c531b4c 100644
> --- a/gst/encoding/gststreamsplitter.c
> +++ b/gst/encoding/gststreamsplitter.c
> @@ -268,10 +268,13 @@ resync:
>      GstPad *srcpad = (GstPad *) tmp->data;
>  
>      STREAMS_UNLOCK (stream_splitter);
> -    if (res)
> -      gst_caps_merge (res, gst_pad_peer_get_caps_reffed (srcpad));
> -    else
> +    if (res) {
> +      GstCaps *peercaps = gst_pad_peer_get_caps_reffed (srcpad);
> +      if (peercaps)
> +        gst_caps_merge (res, gst_caps_make_writable (peercaps));
> +    } else {
>        res = gst_pad_peer_get_caps (srcpad);
> +    }
>      STREAMS_LOCK (stream_splitter);

hmm, why do the caps passed as 2nd arg to _merge() be writable? Also if
so, just use gst_pad_peer_get_caps() instead of the _reffed() variant
then. This always returns writable caps.

Stefan
>  
>      if (G_UNLIKELY (cookie != stream_splitter->cookie)) {
>
> _______________________________________________
> gstreamer-commits mailing list
> gstreamer-commits at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-commits



More information about the gstreamer-devel mailing list