From 1e16817e390f2156964f0bb20393ab62a3a804dc Mon Sep 17 00:00:00 2001 From: Thomas Scholtes Date: Thu, 3 Apr 2014 20:30:41 +0200 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20start=20playing=20automatically?= =?UTF-8?q?=20when=20buffer=20is=20full?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, when `Audio.pause_playback()` was called while buffering, the audio actor would switch back to the playing state when the buffer was full. --- mopidy/audio/actor.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mopidy/audio/actor.py b/mopidy/audio/actor.py index 8dfe0fa8..41bcec94 100644 --- a/mopidy/audio/actor.py +++ b/mopidy/audio/actor.py @@ -49,6 +49,7 @@ class Audio(pykka.ThreadingActor): #: The GStreamer state mapped to :class:`mopidy.audio.PlaybackState` state = PlaybackState.STOPPED + _target_state = gst.STATE_NULL def __init__(self, config): super(Audio, self).__init__() @@ -283,7 +284,7 @@ class Audio(pykka.ThreadingActor): percent = message.parse_buffering() if percent < 10: self._playbin.set_state(gst.STATE_PAUSED) - if percent == 100: + if percent == 100 and self._target_state == gst.STATE_PLAYING: self._playbin.set_state(gst.STATE_PLAYING) logger.debug('Buffer %d%% full', percent) elif message.type == gst.MESSAGE_EOS: @@ -477,6 +478,7 @@ class Audio(pykka.ThreadingActor): :type state: :class:`gst.State` :rtype: :class:`True` if successfull, else :class:`False` """ + self._target_state = state result = self._playbin.set_state(state) if result == gst.STATE_CHANGE_FAILURE: logger.warning(