Python Discoverer crash

Matt Veenstra matt at tribalmedia.com
Thu Mar 3 12:21:00 PST 2011


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


More information about the gstreamer-devel mailing list