[rhythmbox] replaygain: add workaround for pygobject/gst-python refcount problems



commit 22f43cbc01792ecce0ed002ca86ba71c848604cc
Author: Jonathan Matthew <jonathan d14n org>
Date:   Tue Jun 15 22:56:00 2010 +1000

    replaygain: add workaround for pygobject/gst-python refcount problems
    
    The problem only seems to affect ghost pads, so maybe if we split the
    rgvolume ! rglimiter filter into two, it'll work.

 plugins/replaygain/replaygain/player.py |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)
---
diff --git a/plugins/replaygain/replaygain/player.py b/plugins/replaygain/replaygain/player.py
index 8e1564f..fac3aa7 100644
--- a/plugins/replaygain/replaygain/player.py
+++ b/plugins/replaygain/replaygain/player.py
@@ -177,16 +177,27 @@ class ReplayGainPlayer(object):
 		else:
 			playbin.connect("notify::uri", self.playbin2_uri_notify_cb)
 
-		self.rgfilter = gst.Bin()
-		self.rgfilter.add(self.rgvolume, self.rglimiter)
-		self.rgvolume.link(self.rglimiter)
-		self.rgfilter.add_pad(gst.GhostPad("sink", self.rgvolume.get_static_pad("sink")))
-		self.rgfilter.add_pad(gst.GhostPad("src", self.rglimiter.get_static_pad("src")))
-		self.player.add_filter(self.rgfilter)
+		# try to work around bug #621632
+		if gobject.pygobject_version > (2,21,1):
+			print "working around pygobject/gst-python refcount bug.."
+			self.player.add_filter(self.rgvolume)
+			self.player.add_filter(self.rglimiter)
+			self.rgfilter = None
+		else:
+			self.rgfilter = gst.Bin()
+			self.rgfilter.add(self.rgvolume, self.rglimiter)
+			self.rgvolume.link(self.rglimiter)
+			self.rgfilter.add_pad(gst.GhostPad("sink", self.rgvolume.get_static_pad("sink")))
+			self.rgfilter.add_pad(gst.GhostPad("src", self.rglimiter.get_static_pad("src")))
+			self.player.add_filter(self.rgfilter)
 
 	def deactivate_playbin2_mode(self):
-		self.player.remove_filter(self.rgfilter)
-		self.rgfilter = None
+		if self.rgfilter == None:
+			self.player.remove_filter(self.rglimiter)
+			self.player.remove_filter(self.rgvolume)
+		else:
+			self.player.remove_filter(self.rgfilter)
+			self.rgfilter = None
 
 		self.shell_player.disconnect(self.pec_id)
 		self.pec_id = None



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]