mirror of
https://github.com/qemu/qemu.git
synced 2025-01-20 12:33:26 +08:00
oss: fix fragment setting
Previous patch introduced subtle regression, in cases when OSS_GETVERSION fails the code wasn't falling back to SNDCTL_DSP_SETFRAGMENT. Signed-off-by: malc <av1474@comtv.ru>
This commit is contained in:
parent
6d246526ce
commit
3d709fe73a
@ -247,6 +247,7 @@ static int oss_open (int in, struct oss_params *req,
|
|||||||
int oflags = conf.exclusive ? O_EXCL : 0;
|
int oflags = conf.exclusive ? O_EXCL : 0;
|
||||||
audio_buf_info abinfo;
|
audio_buf_info abinfo;
|
||||||
int fmt, freq, nchannels;
|
int fmt, freq, nchannels;
|
||||||
|
int setfragment = 1;
|
||||||
const char *dspname = in ? conf.devpath_in : conf.devpath_out;
|
const char *dspname = in ? conf.devpath_in : conf.devpath_out;
|
||||||
const char *typ = in ? "ADC" : "DAC";
|
const char *typ = in ? "ADC" : "DAC";
|
||||||
|
|
||||||
@ -290,9 +291,8 @@ static int oss_open (int in, struct oss_params *req,
|
|||||||
|
|
||||||
if (ioctl (fd, OSS_GETVERSION, &version)) {
|
if (ioctl (fd, OSS_GETVERSION, &version)) {
|
||||||
oss_logerr2 (errno, typ, "Failed to get OSS version\n");
|
oss_logerr2 (errno, typ, "Failed to get OSS version\n");
|
||||||
version = 0;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
if (conf.debug) {
|
if (conf.debug) {
|
||||||
dolog ("OSS version = %#x\n", version);
|
dolog ("OSS version = %#x\n", version);
|
||||||
}
|
}
|
||||||
@ -300,15 +300,18 @@ static int oss_open (int in, struct oss_params *req,
|
|||||||
if (version >= 0x040000) {
|
if (version >= 0x040000) {
|
||||||
int policy = conf.policy;
|
int policy = conf.policy;
|
||||||
if (ioctl (fd, SNDCTL_DSP_POLICY, &policy)) {
|
if (ioctl (fd, SNDCTL_DSP_POLICY, &policy)) {
|
||||||
oss_logerr2 (errno, typ, "Failed to set timing policy to %d\n",
|
oss_logerr2 (errno, typ,
|
||||||
|
"Failed to set timing policy to %d\n",
|
||||||
conf.policy);
|
conf.policy);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
setfragment = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
|
if (setfragment) {
|
||||||
int mmmmssss = (req->nfrags << 16) | ctz32 (req->fragsize);
|
int mmmmssss = (req->nfrags << 16) | ctz32 (req->fragsize);
|
||||||
if (ioctl (fd, SNDCTL_DSP_SETFRAGMENT, &mmmmssss)) {
|
if (ioctl (fd, SNDCTL_DSP_SETFRAGMENT, &mmmmssss)) {
|
||||||
oss_logerr2 (errno, typ, "Failed to set buffer length (%d, %d)\n",
|
oss_logerr2 (errno, typ, "Failed to set buffer length (%d, %d)\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user