diff options
author | wm4 <wm4@nowhere> | 2014-03-09 00:04:37 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-03-09 01:27:41 +0100 |
commit | a477481aabaa16f1ed15af456125160bc8face5a (patch) | |
tree | c99949f3e13e7c7ba498c56edcbcfa433e487cd3 /audio/mixer.c | |
parent | 5ffd6a9e9b7a0d894d7513ad20c24c2727426ecd (diff) | |
download | mpv-a477481aabaa16f1ed15af456125160bc8face5a.tar.bz2 mpv-a477481aabaa16f1ed15af456125160bc8face5a.tar.xz |
audio/out: feed AOs from a separate thread
This has 2 goals:
- Ensure that AOs have always enough data, even if the device buffers
are very small.
- Reduce complexity in some AOs, which do their own buffering.
One disadvantage is that performance is slightly reduced due to more
copying.
Implementation-wise, we don't change ao.c much, and instead "redirect"
the driver's callback to an API wrapper in push.c.
Additionally, we add code for dealing with AOs that have a pull API.
These AOs usually do their own buffering (jack, coreaudio, portaudio),
and adding a thread is basically a waste. The code in pull.c manages
a ringbuffer, and allows callback-based AOs to read data directly.
Diffstat (limited to 'audio/mixer.c')
-rw-r--r-- | audio/mixer.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/audio/mixer.c b/audio/mixer.c index 34a1722c80..bf4db223b8 100644 --- a/audio/mixer.c +++ b/audio/mixer.c @@ -244,7 +244,7 @@ static void probe_softvol(struct mixer *mixer) if (mixer->opts->softvol == SOFTVOL_AUTO) { // No system-wide volume => fine with AO volume control. mixer->softvol = - ao_control(mixer->ao, AOCONTROL_HAS_TEMP_VOLUME, 0) != 1 && + ao_control(mixer->ao, AOCONTROL_HAS_TEMP_VOLUME, 0) != 1 || ao_control(mixer->ao, AOCONTROL_HAS_PER_APP_VOLUME, 0) != 1; } else { mixer->softvol = mixer->opts->softvol == SOFTVOL_YES; @@ -278,8 +278,8 @@ static void restore_volume(struct mixer *mixer) const char *prev_driver = mixer->driver; mixer->driver = mixer->softvol ? "softvol" : ao_get_name(ao); - bool restore - = mixer->softvol || ao_control(ao, AOCONTROL_HAS_TEMP_VOLUME, 0) == 1; + bool restore = + mixer->softvol || ao_control(ao, AOCONTROL_HAS_TEMP_VOLUME, 0) == 1; // Restore old parameters if volume won't survive reinitialization. // But not if volume scale is possibly different. |