From b90d18c8ac4be31d404aabc74b171f0a89dfcfe9 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Tue, 17 Mar 2015 20:56:16 +0100 Subject: [PATCH 1/3] audio: Reduce most buffering message to trace level --- mopidy/audio/actor.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mopidy/audio/actor.py b/mopidy/audio/actor.py index 63b0eebe..e137b944 100644 --- a/mopidy/audio/actor.py +++ b/mopidy/audio/actor.py @@ -343,15 +343,18 @@ class _Handler(object): self._audio._playbin, gst.DEBUG_GRAPH_SHOW_ALL, 'mopidy') def on_buffering(self, percent): - gst_logger.debug('Got buffering message: percent=%d%%', percent) - + level = logging.getLevelName('TRACE') if percent < 10 and not self._audio._buffering: self._audio._playbin.set_state(gst.STATE_PAUSED) self._audio._buffering = True + level = logging.DEBUG if percent == 100: self._audio._buffering = False if self._audio._target_state == gst.STATE_PLAYING: self._audio._playbin.set_state(gst.STATE_PLAYING) + level = logging.DEBUG + + gst_logger.log(level, 'Got buffering message: percent=%d%%', percent) def on_end_of_stream(self): gst_logger.debug('Got end-of-stream message.') From 8983608992c6c36d10e8da4f6902f8b9a19213c1 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Tue, 17 Mar 2015 20:56:58 +0100 Subject: [PATCH 2/3] audio: Never buffer live sources as they would stall --- mopidy/audio/actor.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mopidy/audio/actor.py b/mopidy/audio/actor.py index e137b944..4805e617 100644 --- a/mopidy/audio/actor.py +++ b/mopidy/audio/actor.py @@ -279,7 +279,7 @@ class _Handler(object): if msg.type == gst.MESSAGE_STATE_CHANGED and msg.src == self._element: self.on_playbin_state_changed(*msg.parse_state_changed()) elif msg.type == gst.MESSAGE_BUFFERING: - self.on_buffering(msg.parse_buffering()) + self.on_buffering(msg.parse_buffering(), msg.structure) elif msg.type == gst.MESSAGE_EOS: self.on_end_of_stream() elif msg.type == gst.MESSAGE_ERROR: @@ -342,7 +342,11 @@ class _Handler(object): gst.DEBUG_BIN_TO_DOT_FILE( self._audio._playbin, gst.DEBUG_GRAPH_SHOW_ALL, 'mopidy') - def on_buffering(self, percent): + def on_buffering(self, percent, structure=None): + if structure and structure.has_field('buffering-mode'): + if structure['buffering-mode'] == gst.BUFFERING_LIVE: + return # Live sources stall in paused. + level = logging.getLevelName('TRACE') if percent < 10 and not self._audio._buffering: self._audio._playbin.set_state(gst.STATE_PAUSED) From b1448f584f0d90a697a1978e458729a7175c1449 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Tue, 17 Mar 2015 21:08:20 +0100 Subject: [PATCH 3/3] audio: Remove download flag from audio (fixes #1041) This should resolve the issue where Mopidy tries and download way to much of a remote track before playing it. --- mopidy/audio/actor.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mopidy/audio/actor.py b/mopidy/audio/actor.py index 4805e617..788fbab4 100644 --- a/mopidy/audio/actor.py +++ b/mopidy/audio/actor.py @@ -48,8 +48,10 @@ MB = 1 << 20 # GST_PLAY_FLAG_DEINTERLACE (1<<9) # GST_PLAY_FLAG_SOFT_COLORBALANCE (1<<10) -# Default flags to use for playbin: AUDIO, SOFT_VOLUME, DOWNLOAD -PLAYBIN_FLAGS = (1 << 1) | (1 << 4) | (1 << 7) +# Default flags to use for playbin: AUDIO, SOFT_VOLUME +# TODO: consider removing soft volume when we do multi outputs and handling it +# ourselves. +PLAYBIN_FLAGS = (1 << 1) | (1 << 4) class _Signals(object):