GNOME Bugzilla – Bug 739351
baseparse: parser fixed caps flag issue
Last modified: 2018-11-03 12:23:48 UTC
Created attachment 289582 [details] test stream Using the aacparse with differents caps in a stream starting with 6 channels, then 2 channels, the aacparse tries to get the allowed caps. As the baseparse is configured with gst_pad_use_fixed_caps (parse->srcpad), the allowed caps on the second negociation is always the current caps. The aacparse therefore tries a "raw" caps instead of adts. I was wondering if the configuration of the fixed caps should really be done in baseparse or if it should be done in the subclass. The documentation of baseparse is not clear to me: "Things that subclass need to take care of: Fixate the source pad caps when appropriate " The provided stream shows the issue. gst-launch-1.0 -v --gst-debug=*:3,aacparse:6 filesrc location= aac.gdp ! gdpdepay ! aacparse ! avdec_aac ! fakesink silent=true I provide two patches (one in baseparse and one in aacparse) as I am not sure where the fix should be handled Results: 0:00:01.953332579 2563 0x129acf0 LOG aacparse gstaacparse.c:1262:gst_aac_parse_handle_frame:<aacparse0> rate: 48000, chans: 6 0:00:01.954749635 2563 0x129acf0 LOG aacparse gstaacparse.c:1262:gst_aac_parse_handle_frame:<aacparse0> rate: 48000, chans: 2 0:00:01.955019481 2563 0x129acf0 DEBUG aacparse gstaacparse.c:172:gst_aac_parse_set_src_caps:<aacparse0> sink caps: (NULL) 0:00:01.955442520 2563 0x129acf0 DEBUG aacparse gstaacparse.c:210:gst_aac_parse_set_src_caps:<aacparse0:src> Caps can not intersect 0:00:01.955794067 2563 0x129acf0 DEBUG aacparse gstaacparse.c:213:gst_aac_parse_set_src_caps:<aacparse0:src> Input is ADTS, trying raw 0:00:01.956069992 2563 0x129acf0 DEBUG aacparse gstaacparse.c:256:gst_aac_parse_set_src_caps:<aacparse0> setting src caps: audio/mpeg, framed=(boolean)true, mpegversion=(int)2, rate=(int)48000, channels=(int)2, stream-format=(string)raw /GstPipeline:pipeline0/GstAacParse:aacparse0.GstPad:src: caps = audio/mpeg, framed=(boolean)true, mpegversion=(int)2, rate=(int)48000, channels=(int)2, stream-format=(string)raw /GstPipeline:pipeline0/avdec_aac:avdec_aac0.GstPad:sink: caps = audio/mpeg, framed=(boolean)true, mpegversion=(int)2, rate=(int)48000, channels=(int)2, stream-format=(string)raw /GstPipeline:pipeline0/avdec_aac:avdec_aac0.GstPad:src: caps = audio/x-raw, format=(string)F32LE, layout=(string)interleaved, rate=(int)48000, channels=(int)2, channel-mask=(bitmask)0x0000000000000003 /GstPipeline:pipeline0/GstFakeSink:fakesink0.GstPad:sink: caps = audio/x-raw, format=(string)F32LE, layout=(string)interleaved, rate=(int)48000, channels=(int)2, channel-mask=(bitmask)0x0000000000000003 0:00:01.989942687 2563 0x129acf0 LOG aacparse gstaacparse.c:1262:gst_aac_parse_handle_frame:<aacparse0> rate: 48000, chans: 2 Expected: 0:00:01.497882759 2548 0xa9aef0 LOG aacparse gstaacparse.c:1262:gst_aac_parse_handle_frame:<aacparse0> rate: 48000, chans: 6 0:00:01.499493903 2548 0xa9aef0 LOG aacparse gstaacparse.c:1262:gst_aac_parse_handle_frame:<aacparse0> rate: 48000, chans: 2 0:00:01.499751062 2548 0xa9aef0 DEBUG aacparse gstaacparse.c:172:gst_aac_parse_set_src_caps:<aacparse0> sink caps: (NULL) 0:00:01.500215872 2548 0xa9aef0 DEBUG aacparse gstaacparse.c:256:gst_aac_parse_set_src_caps:<aacparse0> setting src caps: audio/mpeg, framed=(boolean)true, mpegversion=(int)2, rate=(int)48000, channels=(int)2, stream-format=(string)adts /GstPipeline:pipeline0/GstAacParse:aacparse0.GstPad:src: caps = audio/mpeg, framed=(boolean)true, mpegversion=(int)2, rate=(int)48000, channels=(int)2, stream-format=(string)adts /GstPipeline:pipeline0/avdec_aac:avdec_aac0.GstPad:sink: caps = audio/mpeg, framed=(boolean)true, mpegversion=(int)2, rate=(int)48000, channels=(int)2, stream-format=(string)adts /GstPipeline:pipeline0/avdec_aac:avdec_aac0.GstPad:src: caps = audio/x-raw, format=(string)F32LE, layout=(string)interleaved, rate=(int)48000, channels=(int)2, channel-mask=(bitmask)0x0000000000000003 /GstPipeline:pipeline0/GstFakeSink:fakesink0.GstPad:sink: caps = audio/x-raw, format=(string)F32LE, layout=(string)interleaved, rate=(int)48000, channels=(int)2, channel-mask=(bitmask)0x0000000000000003 0:00:01.535815837 2548 0xa9aef0 LOG aacparse gstaacparse.c:1262:gst_aac_parse_handle_frame:<aacparse0> rate: 48000, chans: 2
Created attachment 289583 [details] [review] baseparse patch
Created attachment 289584 [details] [review] aacparse patch
Correct me if I'm wrong, but since this flag is set in many base class, I'm not sure it's the right way to fix the issue. Assumimg querying the src pad peer caps will not result in the current negotiated caps, we may do something like this: diff --git a/gst/audioparsers/gstaacparse.c b/gst/audioparsers/gstaacparse.c index aee1248..8fe929b 100644 --- a/gst/audioparsers/gstaacparse.c +++ b/gst/audioparsers/gstaacparse.c @@ -214,7 +214,7 @@ gst_aac_parse_set_src_caps (GstAacParse * aacparse, GstCaps * sink_caps) if (stream_format) gst_structure_set (s, "stream-format", G_TYPE_STRING, stream_format, NULL); - allowed = gst_pad_get_allowed_caps (GST_BASE_PARSE (aacparse)->srcpad); + allowed = gst_pad_peer_query_caps (GST_BASE_PARSE (aacparse)->srcpad, NULL); if (!gst_caps_can_intersect (src_caps, allowed)) { GST_DEBUG_OBJECT (GST_BASE_PARSE (aacparse)->srcpad, "Caps can not intersect"); I didn't make a patch because I'm not sure it's right either and I didn't test it.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/77.