Skip to content
Snippets Groups Projects
Commit 363f03a0 authored by Warren Dukes's avatar Warren Dukes
Browse files

do GETBLKSIZE after setting bitrate, sample size, and channels

b/c the optimal fragment size depends on these settings, but also
GEBLKSIZE causes the fragment size to be set (which cannot be changed
w/o closing and reopening the device).
This fixes a problem a user was having with oss emu10k1 driver where
libao app's were skipping.


git-svn-id: http://svn.xiph.org/trunk/ao@5919 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent 75dcc763
No related branches found
No related tags found
No related merge requests found
...@@ -220,16 +220,6 @@ int ao_plugin_open(ao_device *device, ao_sample_format *format) ...@@ -220,16 +220,6 @@ int ao_plugin_open(ao_device *device, ao_sample_format *format)
/* Now set all of the parameters */ /* 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) switch (format->channels)
{ {
case 1: tmp = 0; case 1: tmp = 0;
...@@ -279,6 +269,17 @@ int ao_plugin_open(ao_device *device, ao_sample_format *format) ...@@ -279,6 +269,17 @@ int ao_plugin_open(ao_device *device, ao_sample_format *format)
goto ERR; 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 */ return 1; /* Open successful */
ERR: ERR:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment