summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaZderMind <github@mazdermind.de>2015-05-22 13:06:51 +0200
committerMaZderMind <github@mazdermind.de>2015-05-22 13:06:51 +0200
commitedcc25932bd94c65134b44c0c24b3984e49b7259 (patch)
treeaa38f881a44b57366a46975b8637d634743f39ec
parenta1d1076b2243f6c1e9527afb0be359407fe2f4c4 (diff)
better error-handling on all pipelines
-rw-r--r--voctocore/lib/audiomix.py13
-rw-r--r--voctocore/lib/avpreviewoutput.py23
-rw-r--r--voctocore/lib/avrawoutput.py23
-rw-r--r--voctocore/lib/videomix.py14
4 files changed, 64 insertions, 9 deletions
diff --git a/voctocore/lib/audiomix.py b/voctocore/lib/audiomix.py
index 857600f..c37d215 100644
--- a/voctocore/lib/audiomix.py
+++ b/voctocore/lib/audiomix.py
@@ -44,6 +44,11 @@ class AudioMix(object):
self.log.debug('Creating Mixing-Pipeline:\n%s', pipeline)
self.mixingPipeline = Gst.parse_launch(pipeline)
+ self.log.debug('Binding Error & End-of-Stream-Signal on Mixing-Pipeline')
+ self.mixingPipeline.bus.add_signal_watch()
+ self.mixingPipeline.bus.connect("message::eos", self.on_eos)
+ self.mixingPipeline.bus.connect("message::error", self.on_error)
+
self.log.debug('Initializing Mixer-State')
self.updateMixerState()
@@ -63,3 +68,11 @@ class AudioMix(object):
def setAudioSource(self, source):
self.selectedSource = source
self.updateMixerState()
+
+ def on_eos(self, bus, message):
+ self.log.debug('Received End-of-Stream-Signal on Mixing-Pipeline')
+
+ def on_error(self, bus, message):
+ self.log.debug('Received Error-Signal on Mixing-Pipeline')
+ (error, debug) = message.parse_error()
+ self.log.debug('Error-Details: #%u: %s', error.code, debug)
diff --git a/voctocore/lib/avpreviewoutput.py b/voctocore/lib/avpreviewoutput.py
index e444a87..0a6123f 100644
--- a/voctocore/lib/avpreviewoutput.py
+++ b/voctocore/lib/avpreviewoutput.py
@@ -47,13 +47,20 @@ class AVPreviewOutput(TCPMultiConnection):
vcaps_out=vcaps_out
)
- self.log.debug('Launching Output-Pipeline:\n%s', pipeline)
- self.receiverPipeline = Gst.parse_launch(pipeline)
- self.receiverPipeline.set_state(Gst.State.PLAYING)
+ self.log.debug('Creating Output-Pipeline:\n%s', pipeline)
+ self.outputPipeline = Gst.parse_launch(pipeline)
+
+ self.log.debug('Binding Error & End-of-Stream-Signal on Output-Pipeline')
+ self.outputPipeline.bus.add_signal_watch()
+ self.outputPipeline.bus.connect("message::eos", self.on_eos)
+ self.outputPipeline.bus.connect("message::error", self.on_error)
+
+ self.log.debug('Launching Output-Pipeline')
+ self.outputPipeline.set_state(Gst.State.PLAYING)
def on_accepted(self, conn):
self.log.debug('Adding fd %u to multifdsink', conn.fileno())
- fdsink = self.receiverPipeline.get_by_name('fd')
+ fdsink = self.outputPipeline.get_by_name('fd')
fdsink.emit('add', conn.fileno())
def on_disconnect(multifdsink, fileno):
@@ -62,3 +69,11 @@ class AVPreviewOutput(TCPMultiConnection):
self.close_connection(conn)
fdsink.connect('client-fd-removed', on_disconnect)
+
+ def on_eos(self, bus, message):
+ self.log.debug('Received End-of-Stream-Signal on Output-Pipeline')
+
+ def on_error(self, bus, message):
+ self.log.debug('Received Error-Signal on Output-Pipeline')
+ (error, debug) = message.parse_error()
+ self.log.debug('Error-Details: #%u: %s', error.code, debug)
diff --git a/voctocore/lib/avrawoutput.py b/voctocore/lib/avrawoutput.py
index ea13ad4..0c363e6 100644
--- a/voctocore/lib/avrawoutput.py
+++ b/voctocore/lib/avrawoutput.py
@@ -36,13 +36,20 @@ class AVRawOutput(TCPMultiConnection):
acaps=Config.get('mix', 'audiocaps'),
vcaps=Config.get('mix', 'videocaps')
)
- self.log.debug('Launching Output-Pipeline:\n%s', pipeline)
- self.receiverPipeline = Gst.parse_launch(pipeline)
- self.receiverPipeline.set_state(Gst.State.PLAYING)
+ self.log.debug('Creating Output-Pipeline:\n%s', pipeline)
+ self.outputPipeline = Gst.parse_launch(pipeline)
+
+ self.log.debug('Binding Error & End-of-Stream-Signal on Output-Pipeline')
+ self.outputPipeline.bus.add_signal_watch()
+ self.outputPipeline.bus.connect("message::eos", self.on_eos)
+ self.outputPipeline.bus.connect("message::error", self.on_error)
+
+ self.log.debug('Launching Output-Pipeline')
+ self.outputPipeline.set_state(Gst.State.PLAYING)
def on_accepted(self, conn, addr):
self.log.debug('Adding fd %u to multifdsink', conn.fileno())
- fdsink = self.receiverPipeline.get_by_name('fd')
+ fdsink = self.outputPipeline.get_by_name('fd')
fdsink.emit('add', conn.fileno())
def on_disconnect(multifdsink, fileno):
@@ -51,3 +58,11 @@ class AVRawOutput(TCPMultiConnection):
self.close_connection(conn)
fdsink.connect('client-fd-removed', on_disconnect)
+
+ def on_eos(self, bus, message):
+ self.log.debug('Received End-of-Stream-Signal on Output-Pipeline')
+
+ def on_error(self, bus, message):
+ self.log.debug('Received Error-Signal on Output-Pipeline')
+ (error, debug) = message.parse_error()
+ self.log.debug('Error-Details: #%u: %s', error.code, debug)
diff --git a/voctocore/lib/videomix.py b/voctocore/lib/videomix.py
index d27c3e3..ffdbef2 100644
--- a/voctocore/lib/videomix.py
+++ b/voctocore/lib/videomix.py
@@ -50,8 +50,12 @@ class VideoMix(object):
self.log.debug('Creating Mixing-Pipeline:\n%s', pipeline)
self.mixingPipeline = Gst.parse_launch(pipeline)
- self.log.debug('Initializing Mixer-State')
+ self.log.debug('Binding Error & End-of-Stream-Signal on Mixing-Pipeline')
+ self.mixingPipeline.bus.add_signal_watch()
+ self.mixingPipeline.bus.connect("message::eos", self.on_eos)
+ self.mixingPipeline.bus.connect("message::error", self.on_error)
+ self.log.debug('Initializing Mixer-State')
self.compositeMode = CompositeModes.fullscreen
self.sourceA = 0
self.sourceB = 1
@@ -167,3 +171,11 @@ class VideoMix(object):
def setCompositeMode(self, mode):
self.compositeMode = mode
self.updateMixerState()
+
+ def on_eos(self, bus, message):
+ self.log.debug('Received End-of-Stream-Signal on Mixing-Pipeline')
+
+ def on_error(self, bus, message):
+ self.log.debug('Received Error-Signal on Mixing-Pipeline')
+ (error, debug) = message.parse_error()
+ self.log.debug('Error-Details: #%u: %s', error.code, debug)