Skip to content

Commit

Permalink
don't log messages at info or warn level after we've stopped the pipe…
Browse files Browse the repository at this point in the history
…line

git-svn-id: https://xpra.org/svn/Xpra/trunk@12474 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Apr 23, 2016
1 parent d93dff9 commit 2c39ca2
Showing 1 changed file with 26 additions and 14 deletions.
40 changes: 26 additions & 14 deletions src/xpra/sound/sound_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,26 @@ def cleanup(self):
log("SoundPipeline.cleanup() done")


def gstloginfo(self, msg, *args):
if self.state!="stopped":
gstlog.info(msg, *args)
else:
gstlog(msg, *args)

def gstlogwarn(self, msg, *args):
if self.state!="stopped":
gstlog.warn(msg, *args)
else:
gstlog(msg, *args)

def new_codec_description(self, desc):
log("new_codec_description(%s) current codec description=%s", desc, self.codec_description)
if not desc:
return
cdl = self.codec_description.lower()
dl = desc.lower()
if not cdl or (cdl!=dl and dl.find(cdl)<0 and cdl.find(dl)<0):
gstlog.info("using audio codec %s", dl)
self.gstloginfo("using audio codec %s", dl)
self.codec_description = dl
self.info["codec_description"] = dl

Expand All @@ -232,7 +244,7 @@ def new_container_description(self, desc):
cdl = self.container_description.lower()
dl = desc.lower()
if not cdl or (cdl!=dl and dl.find(cdl)<0 and cdl.find(dl)<0):
gstlog.info("using container format %s", dl)
self.gstloginfo("using container format %s", dl)
self.container_description = dl
self.info["container_description"] = dl

Expand All @@ -243,7 +255,7 @@ def on_message(self, bus, message):
t = message.type
if t == gst.MESSAGE_EOS:
self.pipeline.set_state(gst.STATE_NULL)
gstlog.info("EOS")
self.gstloginfo("EOS")
self.update_state("stopped")
self.idle_emit("state-changed", self.state)
elif t == gst.MESSAGE_ERROR:
Expand All @@ -266,8 +278,8 @@ def on_message(self, bus, message):
try:
self.parse_message(message)
except Exception as e:
gstlog.warn("Warning: failed to parse gstreamer message:")
gstlog.warn(" %s: %s", type(e), e)
self.gstlogwarn("Warning: failed to parse gstreamer message:")
self.gstlogwarn(" %s: %s", type(e), e)
elif t == gst.MESSAGE_STREAM_STATUS:
gstlog("stream status: %s", message)
try:
Expand Down Expand Up @@ -302,13 +314,13 @@ def on_message(self, bus, message):
elif t == gst.MESSAGE_LATENCY:
gstlog("latency message from %s: %s", message.src, message)
elif t == gst.MESSAGE_INFO:
log.info("pipeline message: %s", message)
self.gstloginfo("pipeline message: %s", message)
elif t == gst.MESSAGE_WARNING:
w = message.parse_warning()
gstlog.warn("pipeline warning: %s", w[0].message)
gstlog.info("pipeline warning: %s", w[1:])
self.gstlogwarn("pipeline warning: %s", w[0].message)
self.gstlogwarn(" %s", w[1:])
else:
gstlog.info("unhandled bus message type %s: %s", t, message)
self.gstlogwarn("unhandled bus message type %s: %s", t, message)
self.emit_info()
return 0

Expand Down Expand Up @@ -337,11 +349,11 @@ def parse_message0(self, message):
found = True
if structure.has_field("type"):
if structure["type"]=="volume-changed":
gstlog.info("volumes=%s", csv("%i%%" % (v*100/2**16) for v in structure["volumes"]))
self.gstloginfo("volumes=%s", csv("%i%%" % (v*100/2**16) for v in structure["volumes"]))
found = True
self.info["volume"] = self.get_volume()
else:
gstlog.info("type=%s", structure["type"])
self.gstloginfo("type=%s", structure["type"])
if structure.has_field("container-format"):
v = structure["container-format"]
self.new_container_description(v)
Expand All @@ -353,8 +365,8 @@ def parse_message0(self, message):
v = structure[x]
gstlog("tag message: %s = %s", x, v)
return #handled
gstlog.info("unknown sound pipeline message %s: %s", message, structure)
gstlog.info(" %s", structure.keys())
self.gstloginfo("unknown sound pipeline message %s: %s", message, structure)
self.gstloginfo(" %s", structure.keys())


def parse_message1(self, message):
Expand Down Expand Up @@ -398,4 +410,4 @@ def parse_message1(self, message):
#no match yet
if len([x for x in tags if x in ("minimum-bitrate", "maximum-bitrate", "channel-mode")])==0:
structure = message.get_structure()
gstlog.info("unknown sound pipeline tag message: %s", structure.to_string())
self.gstloginfo("unknown sound pipeline tag message: %s", structure.to_string())

0 comments on commit 2c39ca2

Please sign in to comment.