Revision 3d709fe7

b/audio/ossaudio.c
247 247
    int oflags = conf.exclusive ? O_EXCL : 0;
248 248
    audio_buf_info abinfo;
249 249
    int fmt, freq, nchannels;
250
    int setfragment = 1;
250 251
    const char *dspname = in ? conf.devpath_in : conf.devpath_out;
251 252
    const char *typ = in ? "ADC" : "DAC";
252 253

  
......
290 291

  
291 292
        if (ioctl (fd, OSS_GETVERSION, &version)) {
292 293
            oss_logerr2 (errno, typ, "Failed to get OSS version\n");
293
            version = 0;
294
        }
295

  
296
        if (conf.debug) {
297
            dolog ("OSS version = %#x\n", version);
298 294
        }
295
        else {
296
            if (conf.debug) {
297
                dolog ("OSS version = %#x\n", version);
298
            }
299 299

  
300
        if (version >= 0x040000) {
301
            int policy = conf.policy;
302
            if (ioctl (fd, SNDCTL_DSP_POLICY, &policy)) {
303
                oss_logerr2 (errno, typ, "Failed to set timing policy to %d\n",
304
                             conf.policy);
305
                goto err;
300
            if (version >= 0x040000) {
301
                int policy = conf.policy;
302
                if (ioctl (fd, SNDCTL_DSP_POLICY, &policy)) {
303
                    oss_logerr2 (errno, typ,
304
                                 "Failed to set timing policy to %d\n",
305
                                 conf.policy);
306
                    goto err;
307
                }
308
                setfragment = 0;
306 309
            }
307 310
        }
308 311
    }
309
    else
310 312
#endif
311
    {
313

  
314
    if (setfragment) {
312 315
        int mmmmssss = (req->nfrags << 16) | ctz32 (req->fragsize);
313 316
        if (ioctl (fd, SNDCTL_DSP_SETFRAGMENT, &mmmmssss)) {
314 317
            oss_logerr2 (errno, typ, "Failed to set buffer length (%d, %d)\n",

Also available in: Unified diff