summaryrefslogtreecommitdiffstats
path: root/audio/out
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 /audio/out
parent4c25b000b5e521c67608284cf23972e2f651e9d3 (diff)
downloadmpv-26500425f6cf97ebec21b6cf0929c2e4c08f46d6.tar.bz2
mpv-26500425f6cf97ebec21b6cf0929c2e4c08f46d6.tar.xz
ao_dsound: raise default buffer size to 200ms, make it configurable
Diffstat (limited to 'audio/out')
-rw-r--r--audio/out/ao_dsound.c8
1 files changed, 5 insertions, 3 deletions
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}
},
};