[Spice-devel] [spice-gtk v1] display-gst: Improve h264 elements filtering

Marc-André Lureau marcandre.lureau at gmail.com
Fri Jul 28 16:24:47 UTC 2017


Hi

On Thu, Jul 13, 2017 at 2:51 PM Pavel Grunt <pgrunt at redhat.com> wrote:
>
> On Thu, 2017-07-13 at 14:33 +0200, Victor Toso wrote:
> > From: Victor Toso <me at victortoso.com>
> >
> > This patch fixes the avdec_h264 element not being present on
> > gstvideo_has_codec() which get all decoder elements from GstRegistry
> > and filter them on our GstCaps in order to get the ones for given
> > codec.
> >
> > The issue is around the filtering. The current GstCaps for h264 is not
> > consider a subset of avdec_h264's capabilites and that will fiter this
> > element out of the list.
> >
> > The proposed solution for that is to set `subsetonly` parameter from
> > gst_element_factory_list_filter() to false.
>
> that is incorrect for the same reason as my patch (some required element plugin
> may be missing)

Not sure which patch you are talking about.

I think the patch solves a bug in the current code. It may not be
perfect, but it is still better :)


>
>
> >
> > While at it, the cap "stream-format=byte-stream" is less useful now
> > because it isn't needed to play the stream - see 6fe88871240c53b8
> >
> > In my system, our debug shows:
> > .. gstvideo_debug_available_decoders: From 228 video decoder elements,
> > - 4 can handle caps   image/jpeg: jpegdec, nvdec, avdec_mjpeg, vaapijpegdec
>
> like here a parser for avdec_mjpeg

So you mean that playbin could fail with this setup?

Probably, there are many reasons why the pipeline may fail. But I
think checking for available elements is doomed to be too limited
(h264 has many profiles etc). One thing we could reasonably have is
run-time installation of missing plugins
(https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-Missing-plugins.html),
removing all that checking code.

Anyway, this patch should be applied for now imho


>
> > - 3 can handle caps  video/x-vp8: vaapidecodebin, vp8dec, avdec_vp8
> > - 4 can handle caps video/x-h264: vaapidecodebin, avdec_h264, nvdec,
> > vaapih264dec
> > - 3 can handle caps  video/x-vp9: vaapidecodebin, vp9dec, avdec_vp9
> >
> > Signed-off-by: Victor Toso <victortoso at redhat.com>
> > ---
> >  src/channel-display-gst.c  | 2 +-
> >  src/channel-display-priv.h | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
> > index 20d236a..1bd7df1 100644
> > --- a/src/channel-display-gst.c
> > +++ b/src/channel-display-gst.c
> > @@ -647,7 +647,7 @@ gboolean gstvideo_has_codec(int codec_type)
> >      }
> >
> >      caps = gst_caps_from_string(gst_opts[codec_type].dec_caps);
> > -    codec_decoders = gst_element_factory_list_filter(all_decoders, caps,
> > GST_PAD_SINK, TRUE);
> > +    codec_decoders = gst_element_factory_list_filter(all_decoders, caps,
> > GST_PAD_SINK, FALSE);
> >      gst_caps_unref(caps);
> >
> >      if (codec_decoders == NULL) {
> > diff --git a/src/channel-display-priv.h b/src/channel-display-priv.h
> > index 04cb4d1..9bfd4ac 100644
> > --- a/src/channel-display-priv.h
> > +++ b/src/channel-display-priv.h
> > @@ -181,7 +181,7 @@ static const struct {
> >       * (hardcoded in spice-server), let's add it here to avoid the warning.
> >       */
> >      { SPICE_DISPLAY_CAP_CODEC_H264, "h264",
> > -      "h264parse ! avdec_h264", "video/x-h264,stream-format=byte-stream" },
> > +      "h264parse ! avdec_h264", "video/x-h264" },
> >
> >      /* SPICE_VIDEO_CODEC_TYPE_VP9 */
> >      { SPICE_DISPLAY_CAP_CODEC_VP9, "vp9",
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list