Python Discoverer crash

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Python Discoverer crash

Matt Veenstra
In stress testing my app.  I eventually crash when using this class to
get duration.  It seems to crash after about 60 to 100 calls.

The error looks
(processLoopSpeedTest.py:4396): GStreamer-CRITICAL **:
gst_poll_get_read_gpollfd: assertion `set != NULL' failed

class cMediaTool:
        # theFile is a local file.  Is not tested with proper URI. expects
format file:///
        # mv this expects a/v file.  Fails if not.
        def OnDiscovered(self, discoverer, ismedia, infile):
                print '\non_discovered:', infile
                self.last_duration = 0
                # we always want the shortest direction to avoid a/v sync issues.
                if (discoverer.videolength >= discoverer.audiolength):
                        self.last_duration = discoverer.audiolength / gst.MSECOND
                else:
                        self.last_duration = discoverer.videolength / gst.MSECOND
                discoverer.print_info()
                self.mainloop.quit()
               
        # this creates its own mainloop to create synchronous call.
        # this might cause bad things ran inside another mainloop.
        def GetFileDuration(self, theFile):
                print("GetDuration")
               
                discoverer = Discoverer(theFile)
                discoverer.print_info()
                discoverer.connect('discovered', self.OnDiscovered, theFile)
               
                # The MainLoop
                self.mainloop = gobject.MainLoop()
                gobject.idle_add(discoverer.discover)
                self.mainloop.run()
                del self.mainloop
                # del discoverer
                return self.last_duration

I call it in a loop like this.  Do I need to do some cleanup that I am missing.

                                aMediaTool = cMediaTool()
                                aVideoDuration = aMediaTool.GetFileDuration(aStream)

Thanks,
Matt
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python Discoverer crash

Jon Nordby
On 3 March 2011 20:21, Matt Veenstra <[hidden email]> wrote:

> class cMediaTool:
>        # theFile is a local file.  Is not tested with proper URI. expects
> format file:///
>        # mv this expects a/v file.  Fails if not.
>        def OnDiscovered(self, discoverer, ismedia, infile):
>                print '\non_discovered:', infile
>                self.last_duration = 0
>                # we always want the shortest direction to avoid a/v sync issues.
>                if (discoverer.videolength >= discoverer.audiolength):
>                        self.last_duration = discoverer.audiolength / gst.MSECOND
>                else:
>                        self.last_duration = discoverer.videolength / gst.MSECOND
>                discoverer.print_info()
>                self.mainloop.quit()
>
>        # this creates its own mainloop to create synchronous call.
>        # this might cause bad things ran inside another mainloop.
>        def GetFileDuration(self, theFile):
>                print("GetDuration")
>
>                discoverer = Discoverer(theFile)
>                discoverer.print_info()
>                discoverer.connect('discovered', self.OnDiscovered, theFile)
>
>                # The MainLoop
>                self.mainloop = gobject.MainLoop()
>                gobject.idle_add(discoverer.discover)
>                self.mainloop.run()
>                del self.mainloop
>                # del discoverer
>                return self.last_duration
I suggest you use GstDiscoverer blocking API if you want a blocking
call, find the python equivalent of
http://library.gnome.org/devel/gst-plugins-libs/unstable/gst-plugins-base-libs-gstdiscoverer.html#gst-discoverer-discover-uri

--
Jon Nordby - www.jonnor.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python Discoverer crash

Matt Veenstra
Thanks jon. I did not know such a thing existed.

tribalmedia mobile message

On Mar 3, 2011, at 5:03 PM, Jon Nordby <[hidden email]> wrote:

> On 3 March 2011 20:21, Matt Veenstra <[hidden email]> wrote:
>> class cMediaTool:
>>        # theFile is a local file.  Is not tested with proper URI. expects
>> format file:///
>>        # mv this expects a/v file.  Fails if not.
>>        def OnDiscovered(self, discoverer, ismedia, infile):
>>                print '\non_discovered:', infile
>>                self.last_duration = 0
>>                # we always want the shortest direction to avoid a/v sync issues.
>>                if (discoverer.videolength >= discoverer.audiolength):
>>                        self.last_duration = discoverer.audiolength / gst.MSECOND
>>                else:
>>                        self.last_duration = discoverer.videolength / gst.MSECOND
>>                discoverer.print_info()
>>                self.mainloop.quit()
>>
>>        # this creates its own mainloop to create synchronous call.
>>        # this might cause bad things ran inside another mainloop.
>>        def GetFileDuration(self, theFile):
>>                print("GetDuration")
>>
>>                discoverer = Discoverer(theFile)
>>                discoverer.print_info()
>>                discoverer.connect('discovered', self.OnDiscovered, theFile)
>>
>>                # The MainLoop
>>                self.mainloop = gobject.MainLoop()
>>                gobject.idle_add(discoverer.discover)
>>                self.mainloop.run()
>>                del self.mainloop
>>                # del discoverer
>>                return self.last_duration
> I suggest you use GstDiscoverer blocking API if you want a blocking
> call, find the python equivalent of
> http://library.gnome.org/devel/gst-plugins-libs/unstable/gst-plugins-base-libs-gstdiscoverer.html#gst-discoverer-discover-uri
>
> --
> Jon Nordby - www.jonnor.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel