After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 705192 - videotestsrc is not work with vaapisink
videotestsrc is not work with vaapisink
Status: RESOLVED FIXED
Product: gstreamer-vaapi
Classification: Other
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gstreamer-vaapi maintainer(s)
gstreamer-vaapi maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-07-31 08:56 UTC by XuGuangxin
Modified: 2013-08-26 10:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
we need filter caps before get_caps returned (1013 bytes, patch)
2013-07-31 08:58 UTC, XuGuangxin
none Details | Review

Description XuGuangxin 2013-07-31 08:56:45 UTC
gst-launch-1.0 videotestsrc ! vaapisink will data abort
Comment 1 XuGuangxin 2013-07-31 08:58:38 UTC
Created attachment 250526 [details] [review]
we need filter caps before get_caps returned

we need filter the caps before get_caps returned.
Comment 2 Gwenole Beauchesne 2013-08-13 04:24:43 UTC
Since I could not reproduce that issue, can you detail a little more the actual configuration you used? e.g. libva + libva-intel-driver versions, gstreamer-vaapi version. If this is from git master (as mentioned), then the associated shasum. Thanks.
Comment 3 XuGuangxin 2013-08-13 06:02:28 UTC
Hi Gwenole:
You can see the color bar?
It's not libva or libva-intel-driver related. the root case is we did not filter the video caps before we get_caps returned. And we return first caps as GST_VAAPI_SURFACE_CAPS. So VideoTestSrc will choose surfac caps as output caps.


here is more details:

1. gst_vaapisink_get_caps_impl will return surface_caps as first cap

static GstCaps *
gst_vaapisink_get_caps_impl(GstBaseSink *base_sink)
{
    GstVaapiSink * const sink = GST_VAAPISINK(base_sink);
    GstCaps *out_caps, *yuv_caps;

    out_caps = gst_caps_from_string(GST_VAAPI_SURFACE_CAPS);
    if (!out_caps)
        return NULL;

    if (gst_vaapisink_ensure_uploader(sink)) {
        yuv_caps = gst_vaapi_uploader_get_caps(sink->uploader);
        if (yuv_caps)
            gst_caps_append(out_caps, gst_caps_copy(yuv_caps));
    }
    return out_caps;
}

2. gst_base_src_default_negotiate expect peer return a subset of thiscaps. but it did not happed in our case.

static gboolean
gst_base_src_default_negotiate (GstBaseSrc * basesrc)
{
  GstCaps *thiscaps;
  GstCaps *caps = NULL;
  GstCaps *peercaps = NULL;
  gboolean result = FALSE;

  /* first see what is possible on our source pad */
  thiscaps = gst_pad_query_caps (GST_BASE_SRC_PAD (basesrc), NULL);
  GST_DEBUG_OBJECT (basesrc, "caps of src: %" GST_PTR_FORMAT, thiscaps);
  /* nothing or anything is allowed, we're done */
  if (thiscaps == NULL || gst_caps_is_any (thiscaps))
    goto no_nego_needed;

  if (G_UNLIKELY (gst_caps_is_empty (thiscaps)))
    goto no_caps;

  /* get the peer caps */
  peercaps = gst_pad_peer_query_caps (GST_BASE_SRC_PAD (basesrc), thiscaps);
  GST_DEBUG_OBJECT (basesrc, "caps of peer: %" GST_PTR_FORMAT, peercaps);
  if (peercaps) {
    /* The result is already a subset of our caps */
    caps = peercaps;
    gst_caps_unref (thiscaps);
  } else {
    /* no peer, work with our own caps then */
    caps = thiscaps;
  }


3. gst_caps_fixate will choose first cap as output cap. it's surface caps.

GstCaps *
gst_caps_fixate (GstCaps * caps)
{
  GstStructure *s;

  g_return_val_if_fail (GST_IS_CAPS (caps), NULL);

  /* default fixation */
  caps = gst_caps_truncate (caps);
  caps = gst_caps_make_writable (caps);
  s = gst_caps_get_structure (caps, 0);
  gst_structure_fixate (s);

  return caps;
}
Comment 4 Gwenole Beauchesne 2013-08-26 09:44:53 UTC
Hi,

(In reply to comment #3)
> Hi Gwenole:
> You can see the color bar?
> It's not libva or libva-intel-driver related. the root case is we did not
> filter the video caps before we get_caps returned. And we return first caps as
> GST_VAAPI_SURFACE_CAPS. So VideoTestSrc will choose surfac caps as output caps.

You are right. Thanks. I was only testing with explicit caps. Sorry. :)

Though, I would push the variant where the first param is the caps we got from gst_vaapisink_get_caps_impl() because I want the intersection to maintain the order of those in priority.
Comment 5 Gwenole Beauchesne 2013-08-26 10:57:00 UTC
Fixed in git master. Thanks.
Comment 6 Gwenole Beauchesne 2013-08-26 10:57:27 UTC
commit 92a124f3065a4f05daf06c100d699b72757983bd
Author: Guangxin.Xu <Guangxin.Xu@intel.com>
Date:   Wed Jul 31 16:49:20 2013 +0800

    vaapisink: fix get_caps() implementation for GStreamer 1.0.
    
    Fix GstBaseSink::get_caps() implementation for GStreamer 1.0.X builds
    by honouring the filter caps argument. More precisely, this fixes the
    following pipeline: gst-launch-1.0 videotestsrc ! vaapisink
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705192
    
    Signed-off-by: Guangxin.Xu <Guangxin.Xu@intel.com>
    Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>