Merge pull request #1442 from trygveaa/fix/audio-config-buffer-size

audio: Add a config option for queue buffer size
This commit is contained in:
Stein Magnus Jodal 2016-02-14 00:27:37 +01:00
commit 6b873816af
6 changed files with 24 additions and 0 deletions

View File

@ -169,6 +169,10 @@ Audio
This should be fixed properly together with :issue:`1222`. (Fixes: This should be fixed properly together with :issue:`1222`. (Fixes:
:issue:`1430`, PR: :issue:`1438`) :issue:`1430`, PR: :issue:`1438`)
- Add a new config option, :confval:`audio/buffer_time`, for setting the buffer
time of the GStreamer queue. If you experience buffering before track
changes, it may help to increase this. Workaround for :issue:`1409`.
Gapless Gapless
------- -------

View File

@ -155,6 +155,17 @@ These are the available audio configurations. For specific use cases, see
``gst-inspect-1.0`` to see what output properties can be set on the sink. ``gst-inspect-1.0`` to see what output properties can be set on the sink.
For example: ``gst-inspect-1.0 shout2send`` For example: ``gst-inspect-1.0 shout2send``
.. confval:: audio/buffer_time
Buffer size in milliseconds.
Expects an integer above 0.
Sets the buffer size of the GStreamer queue. If you experience buffering
before track changes, it may help to increase this, possibly by at least a
few seconds. The default is letting GStreamer decide the size, which at the
time of this writing is 1000.
Logging configuration Logging configuration
===================== =====================

View File

@ -470,6 +470,11 @@ class Audio(pykka.ThreadingActor):
# systems. So leave the default to play it safe. # systems. So leave the default to play it safe.
queue = Gst.ElementFactory.make('queue') queue = Gst.ElementFactory.make('queue')
if self._config['audio']['buffer_time'] > 0:
queue.set_property(
'max-size-time',
self._config['audio']['buffer_time'] * Gst.MSECOND)
audio_sink.add(queue) audio_sink.add(queue)
audio_sink.add(self._outputs) audio_sink.add(self._outputs)

View File

@ -38,6 +38,7 @@ _audio_schema['mixer_track'] = Deprecated()
_audio_schema['mixer_volume'] = Integer(optional=True, minimum=0, maximum=100) _audio_schema['mixer_volume'] = Integer(optional=True, minimum=0, maximum=100)
_audio_schema['output'] = String() _audio_schema['output'] = String()
_audio_schema['visualizer'] = Deprecated() _audio_schema['visualizer'] = Deprecated()
_audio_schema['buffer_time'] = Integer(optional=True, minimum=1)
_proxy_schema = ConfigSchema('proxy') _proxy_schema = ConfigSchema('proxy')
_proxy_schema['scheme'] = String(optional=True, _proxy_schema['scheme'] = String(optional=True,

View File

@ -15,6 +15,7 @@ config_file =
mixer = software mixer = software
mixer_volume = mixer_volume =
output = autoaudiosink output = autoaudiosink
buffer_time =
[proxy] [proxy]
scheme = scheme =

View File

@ -22,6 +22,7 @@ from tests import dummy_audio, path_to_data_dir
class BaseTest(unittest.TestCase): class BaseTest(unittest.TestCase):
config = { config = {
'audio': { 'audio': {
'buffer_time': None,
'mixer': 'fakemixer track_max_volume=65536', 'mixer': 'fakemixer track_max_volume=65536',
'mixer_track': None, 'mixer_track': None,
'mixer_volume': None, 'mixer_volume': None,
@ -38,6 +39,7 @@ class BaseTest(unittest.TestCase):
def setUp(self): # noqa: N802 def setUp(self): # noqa: N802
config = { config = {
'audio': { 'audio': {
'buffer_time': None,
'mixer': 'foomixer', 'mixer': 'foomixer',
'mixer_volume': None, 'mixer_volume': None,
'output': 'testoutput', 'output': 'testoutput',