<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hello All,</p>
    <p>It seems like callback for signal "request-key" is being invoked
      on a different context and user_data is not accesible. App crashes
      when I try to access user_data.</p>
    <p> I have tried to use GMainContext from this <a
        moz-do-not-send="true"
href="https://developer.gnome.org/programming-guidelines/stable/main-contexts.html.en">link</a>
      to get signal callback in the same context but nothing helps.</p>
    <p>Any help would be much appreciated.</p>
    <p>Thanks<br>
    </p>
    <div class="moz-cite-prefix">On 09/04/20 7:44 pm, sameer wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:53c0740d-01ac-dd6d-f266-f16cd03bce67@evontech.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <p>Any updates on this? We are stuck for some while in this issue
        and it is crucial for us to get the srtp recording going.<br>
      </p>
      <div class="moz-cite-prefix">On 09/04/20 2:58 pm, sameer wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:5ab454b3-9604-1da2-3e20-a3a10f475d90@evontech.com">
        <meta http-equiv="Content-Type" content="text/html;
          charset=UTF-8">
        <p>We are running pipeline in a different thread other than the
          main thread of application. Can the unref issue be related to
          different thread context?<br>
        </p>
        <div class="moz-cite-prefix">On 08/04/20 9:03 pm, sameer wrote:<br>
        </div>
        <blockquote type="cite"
          cite="mid:dc306039-4873-1d99-4124-5eb51cf59366@evontech.com">
          <meta http-equiv="Content-Type" content="text/html;
            charset=UTF-8">
          <p>On returning caps instead of *caps the app is crashing
            without showing any errorlogs.</p>
          <p> Do I need to add the callback method in the class as a
            member method?<br>
          </p>
          <blockquote type="cite"
cite="mid:VE1PR03MB5903CFAB9E4496174EF57373A3C00@VE1PR03MB5903.eurprd03.prod.outlook.com">
            <meta http-equiv="Content-Type" content="text/html;
              charset=UTF-8">
            <meta name="Generator" content="Microsoft Word 15 (filtered
              medium)">
            <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"Προ-διαμορφωμένο HTML Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.-HTMLChar
        {mso-style-name:"Προ-διαμορφωμένο HTML Char";
        mso-style-priority:99;
        mso-style-link:"Προ-διαμορφωμένο HTML";
        font-family:Consolas;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle23
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
            <div class="WordSection1">
              <p class="MsoNormal"><o:p> </o:p></p>
              <p class="MsoNormal"><o:p> </o:p></p>
              <div>
                <div style="border:none;border-top:solid #E1E1E1
                  1.0pt;padding:3.0pt 0cm 0cm 0cm">
                  <p class="MsoNormal"><b><span lang="EL">From:</span></b><span
                      lang="EL"> Olivier Crête <a
                        class="moz-txt-link-rfc2396E"
                        href="mailto:olivier.crete@collabora.com"
                        moz-do-not-send="true"><olivier.crete@collabora.com></a>
                      <br>
                      <b>Sent:</b> Wednesday, April 8, 2020 4:47 PM<br>
                      <b>To:</b> Discussion of the development of and
                      with GStreamer <a class="moz-txt-link-rfc2396E"
                        href="mailto:gstreamer-devel@lists.freedesktop.org"
                        moz-do-not-send="true"><gstreamer-devel@lists.freedesktop.org></a><br>
                      <b>Cc:</b> Lefteris Diakakis <a
                        class="moz-txt-link-rfc2396E"
                        href="mailto:ldiakakis@rtelworld.com"
                        moz-do-not-send="true"><ldiakakis@rtelworld.com></a><br>
                      <b>Subject:</b> Re: Need Help Regarding SRTPDEC
                      request_key_callback<o:p></o:p></span></p>
                </div>
              </div>
              <p class="MsoNormal"><o:p> </o:p></p>
              <div>
                <p class="MsoNormal">Hi,<o:p></o:p></p>
              </div>
              <div>
                <p class="MsoNormal"><o:p> </o:p></p>
              </div>
              <div>
                <p class="MsoNormal">On Wed, 2020-04-08 at 18:52 +0530,
                  sameer wrote:<o:p></o:p></p>
              </div>
              <blockquote style="border:none;border-left:solid #729FCF
                1.5pt;padding:0cm 0cm 0cm
                6.0pt;margin-left:4.8pt;margin-right:0cm">
                <p>Thank you for the quick reply!<o:p></o:p></p>
                <p>We have not unref the srtpdec object anywhere. Even
                  made the srtpdec object global.<o:p></o:p></p>
                <div>
                  <p>Following is our implementation of callback:<o:p></o:p></p>
                  <p>g_signal_connect(G_OBJECT(srtpdec), "request-key",
                    G_CALLBACK (request_key_callback), &masterKey);<o:p></o:p></p>
                  <p>// masterKey is string<o:p></o:p></p>
                  <p>// srtpdec is global GstElement<o:p></o:p></p>
                  <p>GstCaps request_key_callback (GstElement 
                    gstsrtpdec, guint  ssrc, gpointer  udata) <o:p></o:p></p>
                </div>
              </blockquote>
              <div>
                <p class="MsoNormal">The return value should be a
                  "GstCaps *"<o:p></o:p></p>
              </div>
              <div>
                <p class="MsoNormal"><o:p> </o:p></p>
              </div>
              <blockquote style="border:none;border-left:solid #729FCF
                1.5pt;padding:0cm 0cm 0cm
                6.0pt;margin-left:4.8pt;margin-right:0cm">
                <div>
                  <p>{   <br>
                        string *key = (string*)udata;<br>
                        GstCaps *caps = gst_caps_new_simple
                    ("application/x-srtp",<br>
                          "payload", G_TYPE_INT, 0,<br>
                          "ssrc", G_TYPE_UINT, ssrc,<br>
                          "srtp-key", G_TYPE_STRING, key->c_str(),<br>
                          "srtp-auth", G_TYPE_STRING, "hmac-sha1-80",<br>
                          "srtp-cipher", G_TYPE_STRING, "aes-128-icm",<br>
                          "srtcp-auth", G_TYPE_STRING, "hmac-sha1-80",<br>
                          "srtcp-cipher", G_TYPE_STRING, "aes-128-icm",<br>
                          "roc", G_TYPE_UINT, 0,<br>
                          NULL);<br>
                        return *caps;<br>
                    }<o:p></o:p></p>
                </div>
              </blockquote>
              <div>
                <p class="MsoNormal">And you should "return caps;"<o:p></o:p></p>
              </div>
              <div>
                <p class="MsoNormal"><o:p> </o:p></p>
              </div>
              <div>
                <p class="MsoNormal">Olivier<o:p></o:p></p>
              </div>
              <div>
                <p class="MsoNormal"><o:p> </o:p></p>
              </div>
              <blockquote style="border:none;border-left:solid #729FCF
                1.5pt;padding:0cm 0cm 0cm
                6.0pt;margin-left:4.8pt;margin-right:0cm">
                <div>
                  <p>Is it the correct way?<o:p></o:p></p>
                  <p>Thanks<o:p></o:p></p>
                </div>
                <blockquote style="border:none;border-left:solid #729FCF
                  1.5pt;padding:0cm 0cm 0cm
                  6.0pt;margin-left:4.8pt;margin-right:0cm">
                  <p class="MsoNormal"> <o:p></o:p></p>
                  <p class="MsoNormal"> <o:p></o:p></p>
                  <div>
                    <div style="border:none;border-top:solid #E1E1E1
                      1.0pt;padding:3.0pt 0cm 0cm 0cm">
                      <p class="MsoNormal"><b><span lang="EL">From:</span></b><span
                          lang="EL"> Olivier Crête <a
                            href="mailto:olivier.crete@collabora.com"
                            moz-do-not-send="true"><olivier.crete@collabora.com></a>
                          <br>
                          <b>Sent:</b> Wednesday, April 8, 2020 3:52 PM<br>
                          <b>To:</b> Discussion of the development of
                          and with GStreamer <a
                            href="mailto:gstreamer-devel@lists.freedesktop.org"
                            moz-do-not-send="true">
                            <gstreamer-devel@lists.freedesktop.org></a><br>
                          <b>Cc:</b> Lefteris Diakakis <a
                            href="mailto:ldiakakis@rtelworld.com"
                            moz-do-not-send="true"><ldiakakis@rtelworld.com></a><br>
                          <b>Subject:</b> Re: Need Help Regarding
                          SRTPDEC request_key_callback</span><o:p></o:p></p>
                    </div>
                  </div>
                  <p class="MsoNormal"> <o:p></o:p></p>
                  <div>
                    <p class="MsoNormal">Hi,<o:p></o:p></p>
                  </div>
                  <div>
                    <p class="MsoNormal"> <o:p></o:p></p>
                  </div>
                  <div>
                    <p class="MsoNormal">On Wed, 2020-04-08 at 14:37
                      +0530, sameer wrote:<o:p></o:p></p>
                  </div>
                  <blockquote style="border:none;border-left:solid
                    #729FCF 1.5pt;padding:0cm 0cm 0cm
                    6.0pt;margin-left:4.8pt;margin-right:0cm">
                    <p>The ssrc is not received in sdp. I have
                      implemented the callback function to return
                      capstring as mentioned in the <a
href="https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/gst-plugins-bad-plugins-srtpdec.html"
                        moz-do-not-send="true"> documentation</a> :<o:p></o:p></p>
                    <p><b>static GstCaps request_key_callback
                        (GstElement  gstsrtpdec, guint  ssrc, gpointer 
                        udata) </b><o:p></o:p></p>
                    <p>The capstring returned is like:<o:p></o:p></p>
                    <p><b>"
application/x-srtp,channels=(int)1,media=(string)audio,payload=(int)0,clock-rate=(int)8000,encoding-name=(string)PCMU,ssrc=(uint)1932929554,srtp-key=(buffer)4d73554e564e334354466141365042324168614444436c4a456a754a497673747a354e5961694d5a,srtp-cipher=(string)aes-128-icm,srtp-auth=(string)hmac-sha1-32,srtcp-cipher=(string)aes-128-icm,srtcp-auth=(string)hmac-sha1-32,roc=(uint)0
                        "</b><o:p></o:p></p>
                    <p>But after the callback invokes I am receiving
                      following error:<o:p></o:p></p>
                    <p><b>(recorder:32537): GLib-GObject-CRITICAL **:
                        14:18:06.064: g_object_unref: assertion
                        'G_IS_OBJECT (object)' failed<br>
                        <br>
                        ** (recorder:32537): CRITICAL **: 14:18:06.064:
                        update_session_stream_from_caps: assertion
                        'GST_IS_SRTP_DEC (filter)' failed</b><o:p></o:p></p>
                    <p>and the app crashes.<o:p></o:p></p>
                    <p>Can anyone tell me what mistake I am making. I am
                      not able to find much in the documentation or any
                      examples.<o:p></o:p></p>
                  </blockquote>
                  <div>
                    <p class="MsoNormal"> <o:p></o:p></p>
                  </div>
                  <div>
                    <p class="MsoNormal">You probably unref the srtpdec
                      object somewhere where you shouldn't.<o:p></o:p></p>
                  </div>
                  <div>
                    <p class="MsoNormal"> <o:p></o:p></p>
                  </div>
                  <div>
                    <pre>-- <o:p></o:p></pre>
                    <pre>Olivier Crête<o:p></o:p></pre>
                    <p class="MsoNormal"><a
                        href="mailto:olivier.crete@collabora.com"
                        moz-do-not-send="true"><o:p></o:p></a></p>
                    <pre><u><span style="color:blue"><a href="mailto:olivier.crete@collabora.com" moz-do-not-send="true">olivier.crete@collabora.com<span style="color:windowtext;text-decoration:none"><o:p></o:p></span></a></span></u></pre>
                    <p class="MsoNormal"><o:p> </o:p></p>
                  </div>
                </blockquote>
                <pre>_______________________________________________<o:p></o:p></pre>
                <pre>gstreamer-devel mailing list<o:p></o:p></pre>
                <p class="MsoNormal"><a
                    href="mailto:gstreamer-devel@lists.freedesktop.org"
                    moz-do-not-send="true"><o:p></o:p></a></p>
                <pre><u><span style="color:blue"><a href="mailto:gstreamer-devel@lists.freedesktop.org" moz-do-not-send="true">gstreamer-devel@lists.freedesktop.org<span style="color:windowtext;text-decoration:none"><o:p></o:p></span></a></span></u></pre>
                <p class="MsoNormal"><o:p> </o:p></p>
                <pre><o:p> </o:p></pre>
                <p class="MsoNormal"><a
                    href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel"
                    moz-do-not-send="true"><o:p></o:p></a></p>
                <pre><u><span style="color:blue"><a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" moz-do-not-send="true">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel<span style="color:windowtext;text-decoration:none"><o:p></o:p></span></a></span></u></pre>
                <p class="MsoNormal"><o:p> </o:p></p>
                <pre><o:p> </o:p></pre>
              </blockquote>
              <div>
                <pre>-- <o:p></o:p></pre>
                <pre>Olivier Crête<o:p></o:p></pre>
                <pre><a href="mailto:olivier.crete@collabora.com" moz-do-not-send="true">olivier.crete@collabora.com</a><o:p></o:p></pre>
              </div>
            </div>
          </blockquote>
        </blockquote>
      </blockquote>
    </blockquote>
  </body>
</html>