<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hello Mathew,<div class=""><br class=""></div><div class="">First of all, Thanks a lot for the reply. Even if i don’t set NULL to pipeline and send the EOS event to the pipeline, i never get EOS on the bus. The code i added in the small portion of my project and in the project instead of <font face="arial, sans-serif" class=""><span style="white-space: pre-wrap;" class="">avfvideosrc, we have used v4l2src with appsink. Now without EOS pipeline is not cleaning up it’s resources and i am getting the memory leaks.</span></font></div><div class=""><br class=""></div><div class="">Please help me! i am stuck on this since a month.</div><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Nov 6, 2019, at 5:16 PM, Matthew Waters <<a href="mailto:ystreet00@gmail.com" class="">ystreet00@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
  
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" class="">
  
  <div class="">
    <div class="moz-cite-prefix">You cannot expect any messages on the
      bus after you have set the pipeline to NULL.  Your EOS message
      will be dropped on the floor and
      `self._pipeline.send_event(Gst.Event.new_eos())` would very likely
      return FALSE indicating a failure to send the message.<br class="">
      <br class="">
      Cheers<br class="">
      -Matt<br class="">
      <br class="">
      On 4/11/19 7:46 pm, Ravi Modha wrote:<br class="">
    </div>
    <blockquote type="cite" cite="mid:CAC0Vn7sWeOQYp9NhOY5p_Y_FkprHa_epv1ZkPB9qX9mYMsgn5w@mail.gmail.com" class="">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8" class="">
      <div dir="ltr" class="">
        <div class=""><p dir="auto" class="">I am new to GStreamer and I have created a small
            example where I am recording the webcam and used app sink to
            get the sample but when I try to stop the pipeline by
            setting its state to null and sending EOS event, my bus
            callback function never gets called for the EOS. And because
            of this memory leak is happening.</p><p dir="auto" class="">Guys, Please help me</p><p dir="auto" class=""><br class="">
          </p><p dir="auto" class="">import gi import time import threading</p><p dir="auto" class="">gi.require_version('Gst', '1.0')
            gi.require_version('Gtk', '3.0')
            gi.require_version('GstApp', '1.0')</p><p dir="auto" class="">from gi.repository import GObject, Gst, Gtk,
            GstApp import signal</p><p dir="auto" class="">Gst.init(None)</p><p dir="auto" class="">class Main: </p><p dir="auto" class="">shutdown = False</p>
          <pre style="white-space:pre-wrap" lang="plaintext" class=""><font face="arial, sans-serif" class=""><span id="gmail-m_-3436724900575022937gmail-LC1" lang="plaintext" class="">def __init__(self):</span>
<span id="gmail-m_-3436724900575022937gmail-LC2" lang="plaintext" class="">    signal.signal(signal.SIGINT, self.keyboardInterruptHandler)</span>
<span id="gmail-m_-3436724900575022937gmail-LC3" lang="plaintext" class=""></span>
<span id="gmail-m_-3436724900575022937gmail-LC4" lang="plaintext" class="">    self._pipeline = Gst.parse_launch("avfvideosrc </span>
<span id="gmail-m_-3436724900575022937gmail-LC5" lang="plaintext" class="">    name=avfvideosrc ! x264enc name=x264enc ! appsink </span>
<span id="gmail-m_-3436724900575022937gmail-LC6" lang="plaintext" class="">    name=appsink max-buffers=1 drop=false sync=false emit- </span>
<span id="gmail-m_-3436724900575022937gmail-LC7" lang="plaintext" class="">    signals=true wait-on-eos=false")</span>
<span id="gmail-m_-3436724900575022937gmail-LC8" lang="plaintext" class="">    bus = self._pipeline.get_bus()</span>
<span id="gmail-m_-3436724900575022937gmail-LC9" lang="plaintext" class="">    bus.add_signal_watch()</span>
<span id="gmail-m_-3436724900575022937gmail-LC10" lang="plaintext" class="">    bus.connect("message::eos", self._on_eos_from_sink_pipeline)</span>
<span id="gmail-m_-3436724900575022937gmail-LC11" lang="plaintext" class="">    bus.connect("message", self.on_status_changed)</span>
<span id="gmail-m_-3436724900575022937gmail-LC12" lang="plaintext" class="">    appsink = self._pipeline.get_by_name('appsink')</span>
<span id="gmail-m_-3436724900575022937gmail-LC13" lang="plaintext" class="">    appsink.connect('new-sample', self.on_new_sample)</span>
<span id="gmail-m_-3436724900575022937gmail-LC14" lang="plaintext" class="">    appsink.connect('eos', self.eos)</span>
<span id="gmail-m_-3436724900575022937gmail-LC15" lang="plaintext" class=""></span>
<span id="gmail-m_-3436724900575022937gmail-LC16" lang="plaintext" class="">    #bus.connect('message', self.on_status_changed)</span>
<span id="gmail-m_-3436724900575022937gmail-LC17" lang="plaintext" class="">    self._pipeline.set_state(Gst.State.PLAYING)</span>
<span id="gmail-m_-3436724900575022937gmail-LC18" lang="plaintext" class=""></span>
<span id="gmail-m_-3436724900575022937gmail-LC19" lang="plaintext" class="">def on_new_sample(self, appsink):</span>
<span id="gmail-m_-3436724900575022937gmail-LC20" lang="plaintext" class="">    return Gst.FlowReturn.OK</span>
<span id="gmail-m_-3436724900575022937gmail-LC21" lang="plaintext" class=""></span>
<span id="gmail-m_-3436724900575022937gmail-LC22" lang="plaintext" class="">def _on_eos_from_sink_pipeline(self, _bus, _message):</span>
<span id="gmail-m_-3436724900575022937gmail-LC23" lang="plaintext" class="">    print("Got EOS from sink pipeline")</span>
<span id="gmail-m_-3436724900575022937gmail-LC24" lang="plaintext" class="">    exit()</span>
<span id="gmail-m_-3436724900575022937gmail-LC25" lang="plaintext" class=""></span>
<span id="gmail-m_-3436724900575022937gmail-LC26" lang="plaintext" class="">def eos(self, sink):</span>
<span id="gmail-m_-3436724900575022937gmail-LC27" lang="plaintext" class="">    print("SINK EOS")</span>
<span id="gmail-m_-3436724900575022937gmail-LC28" lang="plaintext" class="">    return True</span>
<span id="gmail-m_-3436724900575022937gmail-LC29" lang="plaintext" class=""></span>
<span id="gmail-m_-3436724900575022937gmail-LC30" lang="plaintext" class="">def on_status_changed(self, bus, message):</span>
<span id="gmail-m_-3436724900575022937gmail-LC31" lang="plaintext" class="">    print('Status: ', message.type)</span>
<span id="gmail-m_-3436724900575022937gmail-LC32" lang="plaintext" class="">    print('Object: ', message.src)</span>
<span id="gmail-m_-3436724900575022937gmail-LC33" lang="plaintext" class="">    print('Parsed Message: ', message.parse_state_changed())</span>
<span id="gmail-m_-3436724900575022937gmail-LC34" lang="plaintext" class=""></span>
<span id="gmail-m_-3436724900575022937gmail-LC35" lang="plaintext" class="">def keyboardInterruptHandler(self,signal, frame):</span>
<span id="gmail-m_-3436724900575022937gmail-LC36" lang="plaintext" class="">    print("KeyboardInterrupt (ID: {}) has been caught. Cleaning </span>
<span id="gmail-m_-3436724900575022937gmail-LC37" lang="plaintext" class="">    up...".format(signal))</span>
<span id="gmail-m_-3436724900575022937gmail-LC38" lang="plaintext" class="">    self.shutdown = True</span>
<span id="gmail-m_-3436724900575022937gmail-LC39" lang="plaintext" class="">    self.stopFetching()</span>
<span id="gmail-m_-3436724900575022937gmail-LC40" lang="plaintext" class=""></span>
<span id="gmail-m_-3436724900575022937gmail-LC41" lang="plaintext" class="">def stopFetching(self):</span>
<span id="gmail-m_-3436724900575022937gmail-LC42" lang="plaintext" class="">    print("AT THE START OF STOP FETCHING")       </span>
<span id="gmail-m_-3436724900575022937gmail-LC43" lang="plaintext" class="">    self._pipeline.set_state(Gst.State.NULL)</span>
<span id="gmail-m_-3436724900575022937gmail-LC44" lang="plaintext" class="">    self._pipeline.send_event(Gst.Event.new_eos())</span>
<span id="gmail-m_-3436724900575022937gmail-LC45" lang="plaintext" class="">    print("AT THE END OF STOP FETCHING")</span>
</font></pre>
          <pre style="white-space:pre-wrap" lang="plaintext" class=""><font face="arial, sans-serif" class="">start = Main()
Gtk.main()`</font></pre>
          <font color="#888888" class="">--<br class="">
            <div dir="ltr" class="">
              <div dir="ltr" class="">
                <div style="font-size:12.8px" class="">
                  <div class=""><font face="arial, helvetica, sans-serif" color="#0b5394" class=""><font size="2" class=""><b class="">Thanks &
                          Regards</b></font><font style="font-weight:bold" size="1" class="">,</font></font></div>
                </div>
              </div>
            </div>
          </font></div>
        -- <br class="">
        <div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">
          <div dir="ltr" class="">
            <div style="color:rgb(136,136,136);font-size:12.8px" class="">
              <div class=""><font face="arial, helvetica, sans-serif" color="#0b5394" class=""><font size="2" class=""><b class="">Thanks & Regards</b></font><font style="font-weight:bold" size="1" class="">,</font></font></div>
              <div class=""><font face="arial, helvetica, sans-serif" class=""><font style="font-weight:bold" size="1" color="#0b5394" class=""><br class="">
                  </font></font></div>
            </div>
            <div class=""><font face="arial, helvetica, sans-serif" color="#0b5394" class=""><b class="">Ravi Modha</b></font></div>
            <div style="color:rgb(136,136,136)" class=""><font color="#0b5394" class=""><font face="arial, helvetica, sans-serif" class=""><b style="font-size:x-small" class=""><font color="#0b5394" class=""><a href="mailto:ravi.modha@tudip.com" style="color:rgb(17,85,204)" target="_blank" moz-do-not-send="true" class="">ravi.modha@tudip.com</a></font> | </b><b class=""><span style="font-size:xx-small" class="">Skype:</span><font size="1" class=""> </font></b></font></font><b style="color:rgb(11,83,148);font-family:arial,helvetica,sans-serif;font-size:x-small" class=""><font color="#0b5394" class=""><a href="mailto:ravi.modha@tudip.com" style="color:rgb(17,85,204)" target="_blank" moz-do-not-send="true" class="">ravi.modha@tudip.com</a></font></b></div>
            <div style="color:rgb(136,136,136)" class=""><font color="#0b5394" class=""><font face="arial, helvetica, sans-serif" class=""><b class=""><font size="1" class=""><br class="">
                    </font></b></font></font></div>
            <div style="color:rgb(136,136,136);font-size:12.8px" class=""><a href="https://tudip.com/" style="color:rgb(17,85,204);font-size:12.8px" target="_blank" moz-do-not-send="true" class=""><img src="https://drive.google.com/a/tudip.com/uc?id=1zJSxP1wMlTI9XJDYbJGWCkGHmI5b-YcL&export=download" moz-do-not-send="true" class=""></a><span style="font-size:12.8px" class=""> </span><a href="https://in.linkedin.com/company/tudip-technologies-pvt-ltd-" style="color:rgb(17,85,204);font-size:12.8px" target="_blank" moz-do-not-send="true" class=""><img src="https://drive.google.com/a/tudip.com/uc?id=1bePNWXohkGCJvWAIXBS28IrhzeOdr-EM&export=download" moz-do-not-send="true" class=""></a><a href="https://clutch.co/profile/tudip-technologies" style="color:rgb(17,85,204);font-size:12.8px" target="_blank" moz-do-not-send="true" class=""><img src="https://drive.google.com/a/tudip.com/uc?id=1x29SoNoRpMwAqn0F88BtoDNmYWzp47_D&export=download" moz-do-not-send="true" class=""></a><a href="https://www.goodfirms.co/companies/view/4439/tudip-technologies-pvt-ltd" style="color:rgb(17,85,204);font-size:12.8px" target="_blank" moz-do-not-send="true" class=""><img src="https://drive.google.com/a/tudip.com/uc?id=1jd6xtL-FoNWGuQH6U78g02hyYKh4-0Wa&export=download" moz-do-not-send="true" class=""></a><span style="font-size:12.8px" class=""> </span><a href="https://www.facebook.com/TudipTechnologies" style="color:rgb(17,85,204);font-size:12.8px" target="_blank" moz-do-not-send="true" class=""><img src="https://drive.google.com/a/tudip.com/uc?id=1X-lj_gJC1T7qEB1uYIw2GivNd8F_Eb0C&export=download" moz-do-not-send="true" class=""></a><span style="font-size:12.8px" class=""> </span><a href="https://twitter.com/TudipTech" style="color:rgb(17,85,204);font-size:12.8px" target="_blank" moz-do-not-send="true" class=""><img src="https://drive.google.com/a/tudip.com/uc?id=1YGDJSRzIZOvM0VZXzhokH-uGcw9umlH0&export=download" moz-do-not-send="true" class=""></a><span style="font-size:12.8px" class=""> </span><a href="https://www.youtube.com/channel/UCoNPz2mbzNF_AZhLQEzuWCg" style="color:rgb(17,85,204);font-size:12.8px" target="_blank" moz-do-not-send="true" class=""><img src="https://drive.google.com/a/tudip.com/uc?id=12WOVgEFKgxD86LKWFaZN7rJF9VxKV3zH&export=download" moz-do-not-send="true" class=""></a></div>
            <div style="color:rgb(136,136,136);font-size:12.8px" class=""><font style="color:rgb(11,83,148);font-weight:bold" size="1" class=""><font style="color:rgb(17,85,204)" class=""><a href="https://tudip.com/" style="color:rgb(17,85,204)" target="_blank" moz-do-not-send="true" class="">www.tudip.com</a></font> </font><font style="color:rgb(11,83,148);font-weight:bold" size="1" class="">|</font><font style="color:rgb(11,83,148);font-weight:bold" size="1" class=""> <font color="#0b5394" class=""><a href="https://tudip.com/tudip-technologies-in-news/" style="color:rgb(17,85,204)" target="_blank" moz-do-not-send="true" class=""><font color="#0b5394" class="">Tudip
                      in News</font></a> </font></font><br class="">
            </div>
            <div style="color:rgb(136,136,136);font-size:12.8px" class=""><span style="font-weight:bold;font-family:arial;font-size:x-small" class=""><a href="callto:+91%2020%204674%200881" style="color:rgb(17,85,204)" target="_blank" moz-do-not-send="true" class=""><font color="#0b5394" class="">+91 20
                    4674 0881</font></a><font color="#0b5394" class=""> | </font><a href="callto:+1%20408%20216%208162" style="color:rgb(17,85,204)" target="_blank" moz-do-not-send="true" class=""><font color="#0b5394" class="">+1 408
                    216 8162</font></a></span></div>
          </div>
        </div>
      </div>
      <br class="">
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
gstreamer-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a></pre>
    </blockquote><p class=""><br class="">
    </p>
  </div>

</div></blockquote></div><br class=""></div></body></html>