failed to negotiate caps when dynamically change caps on appsrc

Bhoomil Chavda bhch1173 at gmail.com
Fri May 5 11:03:33 UTC 2023


Hi all,
I found one issue with appsrc similar like #372 (closed)
<https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/372>.

Actaully I'm feeding my gstreamer pipeline from ALSA source, and to push
and pull in application buffer I'm using appsrc and appsink.

Below is my pipeline looks for PCM audio, appsrc ! audioconvert !
audioresample ! "audio/x-raw, rate=48000, format=F32LE" ! appsink

and for Compressed audio, appsrc ! CUSTOM_PARSER_ELEMENT !
CUSTOM_DECODER_ELEMENT ! audioconvert ! audioresample ! "audio/x-raw,
rate=48000, format=F32LE" ! appsink

The default caps of appsrc is ANY and when I switch to PCM mode, I'm
setting appsrc caps to "audio/x-raw, rate=WHATEVER_ALSA_GIVE_ME",
format=WHATEVER_ALSA_GIVE_ME, channels=WHATEVER_ALSA_GIVE_ME". It is
working fine. Event 48K to 44.1K switching and updating caps working fine
in runtime. But for compress path, when I switch back to ANY caps then
negotiation has been failed. The reason behind setting ANY caps during
compress mode is, my CUSTOM_PARSER_ELEMENT caps not known when I start
streaming. Actually parser itself produce new caps so I don't want appsrc
to deal with that so go with ANY caps *(That is not the case with PCM mode
and that why I need audio/x-raw with other details so convert and resample
can know)*****. Now this ANY caps based appsrc and CUSTOM_PARSER_ELEMENT
not negotiated.

NOTE: there is detection logic which can detect PCM/compress switching and
from the callback I have did,

   1. unlink appsrc and audioconvert
   2. set appsrc caps to ANY
   3. link appsrc and CUSTOM_PARSER_ELEMENT.

Regards,

Bhoomil C.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20230505/79f5ec87/attachment.htm>


More information about the gstreamer-devel mailing list