summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_oss.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-11-10 23:05:51 +0100
committerwm4 <wm4@nowhere>2013-11-10 23:05:59 +0100
commit3cb4116243e54b0452d88c70a7acd4af17cf8d02 (patch)
treef1e97c8d9f630e81c3e7e7c4022b87952bcfcc15 /audio/out/ao_oss.c
parent6ec1f317654ae1e1424ec7c519cf307aae7c3efe (diff)
downloadmpv-3cb4116243e54b0452d88c70a7acd4af17cf8d02.tar.bz2
mpv-3cb4116243e54b0452d88c70a7acd4af17cf8d02.tar.xz
ao: add ao_play_silence, use for ao_alsa and ao_oss
Also add a corresponding function to audio/format.c, which fills an audio block with silence.
Diffstat (limited to 'audio/out/ao_oss.c')
-rw-r--r--audio/out/ao_oss.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/audio/out/ao_oss.c b/audio/out/ao_oss.c
index 556f3c25c9..db9847851d 100644
--- a/audio/out/ao_oss.c
+++ b/audio/out/ao_oss.c
@@ -508,16 +508,13 @@ static int play(struct ao *ao, void *data, int len, int flags)
static void audio_resume(struct ao *ao)
{
struct priv *p = ao->priv;
- int fillcnt;
#ifndef SNDCTL_DSP_RESET
reset(ao);
#endif
- fillcnt = get_space(ao) - p->prepause_space;
- if (fillcnt > 0 && !(ao->format & AF_FORMAT_SPECIAL_MASK)) {
- void *silence = calloc(fillcnt, 1);
- play(ao, silence, fillcnt, 0);
- free(silence);
- }
+ int fillframes = (get_space(ao) - p->prepause_space) /
+ (af_fmt2bits(ao->format) / 8 * ao->channels.num);
+ if (fillframes > 0)
+ ao_play_silence(ao, fillframes);
}
// return: delay in seconds between first and last sample in buffer