diff --git a/src/plugins/oss/ao_oss.c b/src/plugins/oss/ao_oss.c index e047699e5a7e9cb32db2c82b962df205f0b492db..7c19625083a222f6dbf05f43d0c90fcbea4879b3 100644 --- a/src/plugins/oss/ao_oss.c +++ b/src/plugins/oss/ao_oss.c @@ -220,16 +220,6 @@ int ao_plugin_open(ao_device *device, ao_sample_format *format) /* Now set all of the parameters */ - internal->buf_size = -1; - if ((ioctl(internal->fd,SNDCTL_DSP_GETBLKSIZE, - &(internal->buf_size)) < 0) || - internal->buf_size<=0 ) - { - fprintf(stderr, "libao - OSS cannot get buffer size for " - " device\n"); - goto ERR; - } - switch (format->channels) { case 1: tmp = 0; @@ -279,6 +269,17 @@ int ao_plugin_open(ao_device *device, ao_sample_format *format) goto ERR; } + /* this calculates and sets the fragment size */ + internal->buf_size = -1; + if ((ioctl(internal->fd,SNDCTL_DSP_GETBLKSIZE, + &(internal->buf_size)) < 0) || + internal->buf_size<=0 ) + { + fprintf(stderr, "libao - OSS cannot get buffer size for " + " device\n"); + goto ERR; + } + return 1; /* Open successful */ ERR: