mopidy/mopidy — pull request #290 by jodal (2012-12-23 14:15:46+00:00)
Title: Limit Spotify audio data pushing

This pull request builds upon #289. Merge that pull request to reduce the diff having to be reviewed here.

This hooks the Spotify backend onto the appsrc's `need-data` and `enough-data` signals. When GStreamer signals `enough-data`, the Spotify backend stops pushing new audio buffers at GStreamer. When GStreamer signals `need-data`, the Spotify backend continues pushing new audio buffers.

Currently the buffer size is set to 1MB, and the minimum buffer fill rate is set to 50%. I have not spent much thought on proper values for these numbers, so they should surely be reconsidered.

Logging of buffering messages have been added.

Currently, I haven't seen a single log messages resulting from these changes. Debug log messages should be triggered at both "buffering" messages on the GStreamer bus, and on `need-data` and `enough-data` signals. Thus, I'm not sure these changes has any effect as is.

When we've verified that these changes actually has any effect, it would be interesting to see if limiting the appsrc buffer reduces the memory usage when playing very long tracks, like the 2h track mentioned in #165. If not, we may consider not merging these changes at all.