baseparse: parser fixed caps flag issue
Submitted by Nicolas Huet
Link to original bug (#739351)
Description
Created attachment 289582
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
Attachment 289582, "test stream":
aac.gdp
Version: 1.4.3