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 695879 - mpegvideoparse: outputs incomplete caps with different mpegversion before outputting proper caps
mpegvideoparse: outputs incomplete caps with different mpegversion before out...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.0.5
Other Linux
: Normal major
: 1.0.8
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-03-14 20:55 UTC by m][sko
Modified: 2013-05-18 11:43 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description m][sko 2013-03-14 20:55:48 UTC
test pipeline:
GST_DEBUG="*:3,mpegvideoparse:5,uridecodebin:5,decodebin:5" gst-launch-1.0 uridecodebin uri="file:///home/pi/test_mpeg2.ts" ! fakesink sync=true

test file:
http://live.mdragon.org/test_mpeg2.ts

problem:
tsdemu push mpegversion=2 down to mpegvideoparse but
mpegvideoparse provide mpegvideoparse=1 on src caps

problem is in function gst_mpegv_parse_update_src_caps
as
  gst_caps_set_simple (caps,
      "mpegversion", G_TYPE_INT, (mpvparse->config_flags & FLAG_MPEG2) ? 2 : 1,
      NULL);
set mpeg version base on internal state of mpegvideoparse (mpvparse->config_flags & FLAG_MPEG2 == 0) => mpegversion=1

my fix:
static gboolean
gst_mpegv_parse_set_caps (GstBaseParse * parse, GstCaps * caps)


  if((value = gst_structure_get_value(s, "mpegversion")) != NULL){
	  gint mpegversion = g_value_get_int( value );
	  if(mpegversion == 2){
		  mpvparse->config_flags |= FLAG_MPEG2;
		  mpvparse->update_caps = TRUE;
	  }
  }
Comment 1 m][sko 2013-03-14 20:59:29 UTC
this problem is related to mpeg2 decoder that expect mpegversion==2 
for example gst-omx mpeg2
Comment 2 David Schleef 2013-03-15 00:49:18 UTC
The bug is that the decoder is not accepting mpegversion=1.  See, for example, avdec_mpeg2video.
Comment 3 m][sko 2013-03-15 07:31:45 UTC
I hope that is why caps was designed. to properly set up pipeline and capabilities
I don't have mpeg 1/2 all in one decoder.

and mpegvideoparse have src/sink mpegversion[1, 2]
And in caps unverse it mean OR (mpegversion==1 or mpegversion==2)  if I understand it right
Comment 4 Tim-Philipp Müller 2013-03-16 13:27:05 UTC
 commit 9da6ee87273d5930f400e28717cb768ac18eeffa
 Author: Tim-Philipp Müller <tim@centricular.net>
 Date:   Sat Mar 16 13:20:27 2013 +0000

    omxmpeg2dec: mpeg-2 decoder should be able to handle mpeg-1 too
    
    https://bugzilla.gnome.org/show_bug.cgi?id=695879


IMHO it's still a bug that mpegvideoparse outputs incomplete caps though (no height/width, for one), so re-assigning to mpegvideoparse.
Comment 5 m][sko 2013-03-16 14:02:31 UTC
mpegvideoparse output only mpegversion=1 caps
Comment 6 Tim-Philipp Müller 2013-03-16 14:14:26 UTC
Not here. But it outputs caps with mpegversion=1 first, which is what decodebin/playbin will use to select a decoder.

Strangely enough there even seems to be something racy going on, since it varies from run to run:



$ gst-launch-1.0 uridecodebin uri=file:///home/tpm/samples/misc/695879-test_mpeg2.ts ! fakesink -v | grep mpegvparse | grep src
mpegvparse0:src: caps = video/mpeg, mpegversion=(int)1, systemstream=(boolean)false, parsed=(boolean)true
mpegvparse0:src: caps = video/mpeg, mpegversion=(int)2, systemstream=(boolean)false, parsed=(boolean)true, width=(int)720, height=(int)576, framerate=(fraction)25/1, pixel-aspect-ratio=(fraction)64/45, codec_data=(buffer)000001b32d0..., profile=(string)main, level=(string)main, interlace-mode=(string)mixed

$ gst-launch-1.0 uridecodebin uri=file:///home/tpm/samples/misc/695879-test_mpeg2.ts ! fakesink -v | grep mpegvparse | grep src
mpegvparse0:src: caps = video/mpeg, mpegversion=(int)1, systemstream=(boolean)false, parsed=(boolean)true
mpegvparse0:src: caps = video/mpeg, mpegversion=(int)2, systemstream=(boolean)false, parsed=(boolean)true, width=(int)720, height=(int)576, framerate=(fraction)25/1, pixel-aspect-ratio=(fraction)64/45, codec_data=(buffer)000001b32d0..., profile=(string)main, level=(string)main, interlace-mode=(string)mixed

$ gst-launch-1.0 uridecodebin uri=file:///home/tpm/samples/misc/695879-test_mpeg2.ts ! fakesink -v | grep mpegvparse | grep src
mpegvparse0:src: caps = video/mpeg, mpegversion=(int)1, systemstream=(boolean)false, parsed=(boolean)true

$ gst-launch-1.0 uridecodebin uri=file:///home/tpm/samples/misc/695879-test_mpeg2.ts ! fakesink -v | grep mpegvparse | grep src
mpegvparse0:src: caps = video/mpeg, mpegversion=(int)1, systemstream=(boolean)false, parsed=(boolean)true
mpegvparse0:src: caps = video/mpeg, mpegversion=(int)2, systemstream=(boolean)false, parsed=(boolean)true, width=(int)720, height=(int)576, framerate=(fraction)25/1, pixel-aspect-ratio=(fraction)64/45, codec_data=(buffer)000001b32d0..., profile=(string)main, level=(string)main, interlace-mode=(string)mixed
Comment 7 m][sko 2013-03-16 15:10:10 UTC
it generate src caps base on this (from source files)

gst_caps_set_simple (caps,
      "mpegversion", G_TYPE_INT, (mpvparse->config_flags & FLAG_MPEG2) ? 2 : 1,
      NULL);
Comment 8 Tim-Philipp Müller 2013-05-01 16:43:13 UTC
commit f1a6d84a6c4595a94c5654131a74b6a979f53a04
Author: Tim-Philipp Müller <tim.muller@collabora.co.uk>
Date:   Wed May 1 17:36:47 2013 +0100

    mpegvideoparse: don't announce incomplete source caps
    
    Don't send any source caps yet if we're still in
    drop-buffers-until-we-get-a-sequence-header mode.
    
    Fixes transmuxing of many MPEG-TS/PS streams into
    formats which require things like width, height or
    codec_data on the input caps.
    
    Also fixes issues when using playbin with decoder
    sinks that want width/height etc.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=695879