mirror of
https://github.com/mpv-player/mpv
synced 2025-03-22 19:34:14 +00:00
ao_dsound: raise default buffer size to 200ms, make it configurable
This commit is contained in:
parent
4c25b000b5
commit
26500425f6
@ -181,6 +181,9 @@ Available audio output drivers are:
|
|||||||
Sets the device number to use. Playing a file with ``-v`` will show a
|
Sets the device number to use. Playing a file with ``-v`` will show a
|
||||||
list of available devices.
|
list of available devices.
|
||||||
|
|
||||||
|
``buffersize=<ms>``
|
||||||
|
DirectSound buffer size in milliseconds (default: 200).
|
||||||
|
|
||||||
``sdl``
|
``sdl``
|
||||||
SDL 1.2+ audio output driver. Should work on any platform supported by 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
|
1.2, but may require the ``SDL_AUDIODRIVER`` environment variable to be set
|
||||||
|
@ -98,6 +98,7 @@ struct priv {
|
|||||||
int outburst; ///play in multiple of chunks of this size
|
int outburst; ///play in multiple of chunks of this size
|
||||||
|
|
||||||
int cfg_device;
|
int cfg_device;
|
||||||
|
int cfg_buffersize;
|
||||||
};
|
};
|
||||||
|
|
||||||
static float get_delay(struct ao *ao);
|
static float get_delay(struct ao *ao);
|
||||||
@ -403,11 +404,11 @@ static int init(struct ao *ao)
|
|||||||
ao->samplerate = rate;
|
ao->samplerate = rate;
|
||||||
ao->format = format;
|
ao->format = format;
|
||||||
ao->bps = ao->channels.num * rate * af_fmt2bps(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,
|
MP_VERBOSE(ao, "Samplerate:%iHz Channels:%i Format:%s\n", rate,
|
||||||
ao->channels.num, af_fmt_to_str(format));
|
ao->channels.num, af_fmt_to_str(format));
|
||||||
MP_VERBOSE(ao, "Buffersize:%d bytes (%d msec)\n",
|
MP_VERBOSE(ao, "Buffersize:%d bytes (%f msec)\n",
|
||||||
buffersize, buffersize / ao->bps * 1000);
|
buffersize, buffersize * 1000.0 / ao->bps);
|
||||||
|
|
||||||
//fill waveformatex
|
//fill waveformatex
|
||||||
ZeroMemory(&wformat, sizeof(WAVEFORMATEXTENSIBLE));
|
ZeroMemory(&wformat, sizeof(WAVEFORMATEXTENSIBLE));
|
||||||
@ -636,6 +637,7 @@ const struct ao_driver audio_out_dsound = {
|
|||||||
.priv_size = sizeof(struct priv),
|
.priv_size = sizeof(struct priv),
|
||||||
.options = (const struct m_option[]) {
|
.options = (const struct m_option[]) {
|
||||||
OPT_INT("device", cfg_device, 0),
|
OPT_INT("device", cfg_device, 0),
|
||||||
|
OPT_INTRANGE("buffersize", cfg_buffersize, 0, 1, 10000, OPTDEF_INT(200)),
|
||||||
{0}
|
{0}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user