SrtpDec: request-key-callback results in app crash

Jochen Jung jochenmajjung at gmail.com
Tue Nov 24 01:20:18 UTC 2020


Hello,


You are completely right. The signature was at fault. Changing the return
value to GspCaps* and the callback parameter to GstElement* works out of
the box!

The documentation says otherwise though (GstSrtpDec
<https://gstreamer.freedesktop.org/documentation/srtp/srtpdec.html?gi-language=c#srtpdec::request-key>)
and should be adjusted.


Thanks for clarifying this!
Regards,


Jochen Jung


On Tue, Nov 24, 2020 at 1:22 AM Matthew Waters <ystreet00 at gmail.com> wrote:

> Hi,
>
> You have a number of memory errors in your callback as outlined below.
> You should probably use something like valgrind to have a look at where
> there may be other memory errors.
>
> On 23/11/20 12:37 pm, Jochen Jung wrote:
>
> Hello,
>
>
> I have a similar problem to Need Help Regarding SRTPDEC
> request_key_callback
> <https://lists.freedesktop.org/archives/gstreamer-devel/2020-April/074627.html>,
> which was eventually not resolved.
>
> The following callback is used:
>
> GstCaps StreamDecrypt::keyRequested([[maybe_unused]] GstElement element, guint ssrc, gpointer data)
>>
>>
> This is wrong and needs to have the argument 'GstElement * element'
>
> {
>>
>> 	GstCaps * caps = (GstCaps *)data;
>>
>> 	GValue val_ssrc = G_VALUE_INIT;
>>
>> 	g_value_init(&val_ssrc, G_TYPE_UINT);
>>
>> 	g_value_set_uint(&val_ssrc, ssrc);
>>
>> 	gst_caps_set_value(caps, "ssrc", &val_ssrc);
>>
>> 	dump(caps); // print GstCaps
>>
>> 	return *caps;
>>
>>
> This is wrong, you should not be dereferencing the pointer.
>
> }
>>
>>
> This is how the request-key signal is connected:
>
> g_signal_connect(decrypt->getGstElement(), "request-key", G_CALLBACK(StreamDecrypt::keyRequested), decrypt->getCapsSrtp());
>>
>> // decrypt->getGstElement() returns the GstElement* of the GstSrtpDec.
>>
> // decrypt->getCapsSrtp() returns the GstCaps*.
>>
>
> I confirmed that the GstCaps are set correctly, which are:
>
> application/x-srtp,
>> srtp-key=(buffer)c99a66320db73158a35a255d051758e95ed4abb2cdc69bb454110e827441,
>> srtp-cipher=(string)aes-128-icm, srtp-auth=(string)hmac-sha1-80,
>> srtcp-cipher=(string)aes-128-icm, srtcp-auth=(string)hmac-sha1-80,
>> media=(string)audio, clock-rate=(int)8000, encoding-name=(string)PCMU,
>> payload=(int)0, ssrc=(uint)112235;
>>
>
> During runtime i get the following error:
>
> (AudioStream:9995): GLib-GObject-CRITICAL **: 02:12:00.065:
>> g_object_unref: assertion 'G_IS_OBJECT (object)' failed
>>
>> ** (AudioStream:9995): CRITICAL **: 02:12:00.065:
>> update_session_stream_from_caps: assertion 'GST_IS_SRTP_DEC (filter)' failed
>>
>
> I traced this error back to a function in GstPad. The function
> ACQUIRE_PARENT(pad, parent, label) returns an invliad GstSrtpDev object.
> This invalid GstSrtpDec results in the above mentioned errors in
> GstSrtpDec::update_session_stream_from_caps. The app crash occurs in
> GstCaps::gst_caps_to_string.
>
> Can anyone please tell me what i am doing wrong here? If everything is set
> up correctly i have to assume this is a bug in the plugin.
>
>
> Thanks in advance and regards,
> Jochen Jung
>
>
> _______________________________________________
> gstreamer-devel mailing listgstreamer-devel at lists.freedesktop.orghttps://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20201124/fbcc55bd/attachment.htm>


More information about the gstreamer-devel mailing list