Hi everyone,
I asked Santa for an answer but I doubt I'll receive anything from him, so here we are. I bitbaked with Yocto the "imx-image-multimedia" recipe and flashed on an sd card easily but I'm having issues with the srtp encoder included (or more, that should be included it it was working) with gstreamer bad plugins.
Here is a sample pipeline I'm using:
/usr/bin/gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=YUY2,width=1920,height=1080,framerate=30/1 ! vpuenc_h264 ! rtph264pay config-interval=10 pt=96 ! srtpenc key=aaaaaaaaaaaaaaaaaaaaaa rtp-cipher=aes-128-icm rtp-auth=hmac-sha1-80 rtcp-cipher=aes-128-icm rtcp-auth=hmac-sha1-80 ! udpsink host=10.0.99.149 port=62994
And here is what I get back:
WARNING: erroneous pipeline: no element "srtpenc"
Which is normal considering that the plugin srtpenc isn't properly installed, gst-inspect confirms it:
root@imx8mmevk:~# gst-inspect-1.0 | grep srtpenc
dtls: dtlssrtpenc: DTLS-SRTP Encoder
An analysis of the imx-image-multimedia.bb file shows that :
packagegroup-fsl-gstreamer1.0-full \
are included by default, so why don't I have my plugin in my image ? (the packagegroup-fsl-gstreamer1.0-full includes all plugins: base, good, bad, ugly)
I then tried to add the in my local.conf file in the IMAGE_INSTALL_append section, no luck either.
BTW the default images provided by NXP have the same problem.
已解决! 转到解答。
Ok, so I finally got it working.
A deeper analysis revealed that, by default, the srtp plugin is not compiled in Yocto with the default configuration. This can easily be verified using:
bitbake gstreamer1.0-plugins-bad -e | grep ^PACKAGECONFIG=
So although the srtp plugin is enabled by default in the official source code, here for some reason some people though it wasn't that useful and disabled it.
To include it simply create a .bbappend next to the original file (in this case gstreamer1.0-plugins-bad-1.16.0.bbappend) and add into it:
PACKAGECONFIG_append = " srtp"
then you can bitbake your image as usual.
Ok it looks like I was right, dtlssrtpenc relies on srtpenc, thus it can't be used alone. Here is what happens when I turn on gstreamer debug mode:
root@imx8mmevk:~# export GST_DEBUG=2
root@imx8mmevk:~# gst-launch-1.0 videotestsrc ! videoconvert ! vpuenc_h264 ! rtph264pay ! kk.rtp_sink_0 dtlssrtpenc name=kk key=987654321001234567890123456789012345678901234567890123456789 rtp-cipher=aes-128-icm rtp-auth=hmac-sha1-80 rtcp-cipher=aes-128-icm rtcp-auth=hmac-sha1-80 async-handling=true connection-id=dada is-client=true message-forward=false
0:00:00.066575146 773 0xaaaafedffd90 WARN GST_ELEMENT_FACTORY gstelementfactory.c:456:gst_element_factory_make: no such element factory "srtpenc"!
0:00:00.066661772 773 0xaaaafedffd90 ERROR dtlssrtpenc gstdtlssrtpenc.c:177:gst_dtls_srtp_enc_init:<GstDtlsSrtpEnc@0xaaaafee170d0> failed to create srtp encoder, is the srtp plugin registered?
So back to my initial question, why isn't the srtp module added in my Yocto image ?
Ok, so I finally got it working.
A deeper analysis revealed that, by default, the srtp plugin is not compiled in Yocto with the default configuration. This can easily be verified using:
bitbake gstreamer1.0-plugins-bad -e | grep ^PACKAGECONFIG=
So although the srtp plugin is enabled by default in the official source code, here for some reason some people though it wasn't that useful and disabled it.
To include it simply create a .bbappend next to the original file (in this case gstreamer1.0-plugins-bad-1.16.0.bbappend) and add into it:
PACKAGECONFIG_append = " srtp"
then you can bitbake your image as usual.
What do you mean exactly ? I tried to remove:
packagegroup-fsl-gstreamer1.0-full \
and added instead:
gstreamer1.0 \
gstreamer1.0-plugins-bad \
but still have the same issue.
Right command is dtlssrtpenc
root@imx8mmevk:~# /usr/bin/gst-inspect-1.0 --plugin
level: level: Level
deinterlace: deinterlace: Deinterlacer
dtls: dtlsenc: DTLS Encoder
dtls: dtlsdec: DTLS Decoder
dtls: dtlssrtpdec: DTLS-SRTP Decoder
dtls: dtlssrtpenc: DTLS-SRTP Encoder
dtls: dtlssrtpdemux: DTLS SRTP Demultiplexer
Interesting, "gst-inspect-1.0 dtlssrtpenc" on the i.MX8M EVK shows more capabilities than the official api reference. But still, it looks like "dtlssrtpenc" depends somehow on the "srtpenc" plugin.
root@imx8mmevk:~# gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=YUY2,width=1920,height=1080,framerate=30/1 ! vpuenc_h264 ! rtph264pay ! .rtp_sink_0 dtlssrtpenc key=987654321001234567890123456789012345678901234567890123456789 rtp-cipher=aes-128-icm rtp-auth=hmac-sha1-80 rtcp-cipher=aes-128-icm rtcp-auth=hmac-sha1-80 .src ! udpsink host=10.0.99.149 port=62994
** (gst-launch-1.0:900): CRITICAL **: 13:30:24.985: gst_dtls_srtp_enc_request_new_pad: assertion 'self->srtp_enc' failed
WARNING: erroneous pipeline: could not link rtph264pay0 to dtlssrtpenc0
I think the critical error comes from the nonavailability of the srtp_enc. Or maybe I'm missing something else. The same pipeline (with x264enc instead of vpuenc_h264) works fine under mac OS.
EDIT: I changed the pipeline so that I don't have the second error anymore.