gmyth-stream/server/plugins/transcoders/gmencoder.py
branchtrunk
changeset 837 6b3c7c0b32ad
parent 832 daa61fffb811
child 883 e8a82fc5f075
     1.1 --- a/gmyth-stream/server/plugins/transcoders/gmencoder.py	Wed Aug 29 14:42:10 2007 +0100
     1.2 +++ b/gmyth-stream/server/plugins/transcoders/gmencoder.py	Fri Aug 31 18:31:09 2007 +0100
     1.3 @@ -64,7 +64,6 @@
     1.4              self._insert_param("-o", "file://%s" % path)
     1.5          else:
     1.6              self._insert_param ("-o", "fd://%d" % outfd.fileno())
     1.7 -            self.opts.append ("-c")
     1.8  
     1.9          cmd = " ".join(self.opts)
    1.10          self.log.info(self.tid, "GMencoder: %s" % cmd)
    1.11 @@ -84,8 +83,9 @@
    1.12          try:
    1.13  	    if not outfile:
    1.14  	    	p = select.poll()
    1.15 -	    	p.register (outfd, select.POLLNVAL | select.POLLERR | select.POLLHUP | select.POLLIN )
    1.16 -
    1.17 +	    	p.register (outfd, select.POLLNVAL | select.POLLERR |
    1.18 +                            select.POLLHUP)
    1.19 +            tries = 0
    1.20              while (self.proc and self.proc.poll() == None):
    1.21                  r, w, x = select.select([self.proc.stdout], [], [], 1)
    1.22                  if self.proc.stdout in r:
    1.23 @@ -93,12 +93,17 @@
    1.24                      if (progress.find ("PROGRESS") >= 0):
    1.25                          self.status = progress.split (":")[1]
    1.26  		    elif (progress.find ("Erro") >= 0):
    1.27 -			return False
    1.28 +                        self.log.error(self.tid, "Detected problem @ gmencoder:"
    1.29 +                                       " %s" % progress)
    1.30 +                        if tries < 50:
    1.31 +                            tries += 1
    1.32 +                        else:
    1.33 +                            return False
    1.34  
    1.35  		    if not outfile:
    1.36  			    ret = p.poll(0)
    1.37  			    if ret:
    1.38 -			    	self.log.info(self.tid, "Lost connection")
    1.39 +			    	self.log.info(self.tid, "* Lost connection *")
    1.40  		    		self.stop ()
    1.41  			    	return False
    1.42