1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-17 21:27:08 +00:00

ao_oss: SNDCTL_DSP_CHANNELS takes int, not uint8_t

This caused weird issue, probably caused by setting up the wrong number
of channels, or similar. See github issue #383.

Patch by bugmen0t on github.
This commit is contained in:
wm4 2013-11-30 18:58:18 +01:00
parent 20e08ac84e
commit 228b652ad5

View File

@ -430,10 +430,11 @@ static void reset(struct ao *ao)
ioctl(p->audio_fd, SNDCTL_DSP_SPEED, &ao->samplerate); ioctl(p->audio_fd, SNDCTL_DSP_SPEED, &ao->samplerate);
ioctl(p->audio_fd, SNDCTL_DSP_SETFMT, &oss_format); ioctl(p->audio_fd, SNDCTL_DSP_SETFMT, &oss_format);
if (!AF_FORMAT_IS_AC3(ao->format)) { if (!AF_FORMAT_IS_AC3(ao->format)) {
int c = ao->channels.num;
if (ao->channels.num > 2) if (ao->channels.num > 2)
ioctl(p->audio_fd, SNDCTL_DSP_CHANNELS, &ao->channels.num); ioctl(p->audio_fd, SNDCTL_DSP_CHANNELS, &c);
else { else {
int c = ao->channels.num - 1; c--;
ioctl(p->audio_fd, SNDCTL_DSP_STEREO, &c); ioctl(p->audio_fd, SNDCTL_DSP_STEREO, &c);
} }
ioctl(p->audio_fd, SNDCTL_DSP_SPEED, &ao->samplerate); ioctl(p->audio_fd, SNDCTL_DSP_SPEED, &ao->samplerate);