Update emit_data to return true if data was delivered.

This is probably not needed, but for the sake of correctnes it doesn't hurt.
This commit is contained in:
Thomas Adamcik 2012-11-15 22:38:27 +01:00
parent 0a96e5dccb
commit f2b975cc37
2 changed files with 8 additions and 3 deletions

View File

@ -231,11 +231,14 @@ class Audio(pykka.ThreadingActor):
Note that the uri must be set to ``appsrc://`` for this to work.
Returns true if data was delivered.
:param buffer_: buffer to pass to appsrc
:type buffer_: :class:`gst.Buffer`
:rtype: boolean
"""
source = self._playbin.get_property('source')
source.emit('push-buffer', buffer_)
return source.emit('push-buffer', buffer_) == gst.FLOW_OK
def emit_end_of_stream(self):
"""

View File

@ -115,8 +115,10 @@ class SpotifySessionManager(process.BaseThread, PyspotifySessionManager):
buffer_ = gst.Buffer(bytes(frames))
buffer_.set_caps(gst.caps_from_string(capabilites))
self.audio.emit_data(buffer_)
return num_frames
if self.audio.emit_data(buffer_).get():
return num_frames
else:
return 0
def play_token_lost(self, session):
"""Callback used by pyspotify"""