oss: issue OSS_GETVERSION ioctl only when needed
Signed-off-by: malc <av1474@comtv.ru>
This commit is contained in:
parent
59bc10ee01
commit
6d246526ce
@ -244,9 +244,6 @@ static int oss_open (int in, struct oss_params *req,
|
|||||||
struct oss_params *obt, int *pfd)
|
struct oss_params *obt, int *pfd)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
#ifdef USE_DSP_POLICY
|
|
||||||
int version;
|
|
||||||
#endif
|
|
||||||
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;
|
||||||
@ -288,6 +285,9 @@ static int oss_open (int in, struct oss_params *req,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_DSP_POLICY
|
#ifdef USE_DSP_POLICY
|
||||||
|
if (conf.policy >= 0) {
|
||||||
|
int version;
|
||||||
|
|
||||||
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;
|
version = 0;
|
||||||
@ -297,8 +297,7 @@ static int oss_open (int in, struct oss_params *req,
|
|||||||
dolog ("OSS version = %#x\n", version);
|
dolog ("OSS version = %#x\n", version);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conf.policy >= 0 && 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",
|
||||||
@ -306,6 +305,7 @@ static int oss_open (int in, struct oss_params *req,
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user