summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-08-22 16:10:34 +0200
committerwm4 <wm4@nowhere>2014-08-22 16:12:47 +0200
commit26500425f6cf97ebec21b6cf0929c2e4c08f46d6 (patch)
treef0754cba4faf617bfaf016e5f2a1cbe20509cea1
parent4c25b000b5e521c67608284cf23972e2f651e9d3 (diff)
downloadmpv-26500425f6cf97ebec21b6cf0929c2e4c08f46d6.tar.bz2
mpv-26500425f6cf97ebec21b6cf0929c2e4c08f46d6.tar.xz
ao_dsound: raise default buffer size to 200ms, make it configurable
-rw-r--r--DOCS/man/ao.rst3
-rw-r--r--audio/out/ao_dsound.c8
2 files changed, 8 insertions, 3 deletions
diff --git a/DOCS/man/ao.rst b/DOCS/man/ao.rst
index 5bd82cd9f4..f82906d062 100644
--- a/DOCS/man/ao.rst
+++ b/DOCS/man/ao.rst
@@ -181,6 +181,9 @@ Available audio output drivers are:
Sets the device number to use. Playing a file with ``-v`` will show a
list of available devices.
+ ``buffersize=<ms>``
+ DirectSound buffer size in milliseconds (default: 200).
+
``sdl``
SDL 1.2+ audio output driver. Should work on any platform supported by SDL
1.2, but may require the ``SDL_AUDIODRIVER`` environment variable to be set
diff --git a/audio/out/ao_dsound.c b/audio/out/ao_dsound.c
index e313c7d440..e03db481c8 100644
--- a/audio/out/ao_dsound.c
+++ b/audio/out/ao_dsound.c
@@ -98,6 +98,7 @@ struct priv {
int outburst; ///play in multiple of chunks of this size
int cfg_device;
+ int cfg_buffersize;
};
static float get_delay(struct ao *ao);
@@ -403,11 +404,11 @@ static int init(struct ao *ao)
ao->samplerate = rate;
ao->format = format;
ao->bps = ao->channels.num * rate * af_fmt2bps(format);
- int buffersize = ao->bps * 0.100; // space for 100ms
+ int buffersize = ao->bps * p->cfg_buffersize / 1000;
MP_VERBOSE(ao, "Samplerate:%iHz Channels:%i Format:%s\n", rate,
ao->channels.num, af_fmt_to_str(format));
- MP_VERBOSE(ao, "Buffersize:%d bytes (%d msec)\n",
- buffersize, buffersize / ao->bps * 1000);
+ MP_VERBOSE(ao, "Buffersize:%d bytes (%f msec)\n",
+ buffersize, buffersize * 1000.0 / ao->bps);
//fill waveformatex
ZeroMemory(&wformat, sizeof(WAVEFORMATEXTENSIBLE));
@@ -636,6 +637,7 @@ const struct ao_driver audio_out_dsound = {
.priv_size = sizeof(struct priv),
.options = (const struct m_option[]) {
OPT_INT("device", cfg_device, 0),
+ OPT_INTRANGE("buffersize", cfg_buffersize, 0, 1, 10000, OPTDEF_INT(200)),
{0}
},
};