Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mediastreamer2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
9
Merge Requests
9
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
External Wiki
External Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
BC
public
mediastreamer2
Commits
7e0c696c
Commit
7e0c696c
authored
Jan 12, 2011
by
jehan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use SNDCTL_DSP_SETFRAGMENT instead of SNDCTL_DSP_SUBDIVIDE
parent
bbf27ab7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
13 deletions
+30
-13
oss.c
src/oss.c
+30
-13
No files found.
src/oss.c
View file @
7e0c696c
...
...
@@ -40,7 +40,7 @@ static int configure_fd(int fd, int bits,int stereo, int rate, int *minsz)
{
int
p
=
0
,
cond
=
0
;
int
i
=
0
;
int
min_size
=
0
,
blocksize
=
512
;
int
min_size
=
0
,
blocksize
=
512
,
size_selector
=
9
/*=512*/
;
int
err
;
//g_message("opening sound device");
...
...
@@ -79,22 +79,39 @@ static int configure_fd(int fd, int bits,int stereo, int rate, int *minsz)
if
(
rate
==
16000
)
blocksize
=
4096
;
/* oss emulation is not very good at 16khz */
else
blocksize
=
blocksize
*
(
rate
/
8000
);
ioctl
(
fd
,
SNDCTL_DSP_GETBLKSIZE
,
&
min_size
);
/* try to subdivide BLKSIZE to reach blocksize if necessary */
if
(
min_size
>
blocksize
)
{
cond
=
1
;
p
=
min_size
/
blocksize
;
while
(
cond
)
{
i
=
ioctl
(
fd
,
SNDCTL_DSP_SUBDIVIDE
,
&
p
);
ms_message
(
"subdivide bloc min_size [%i] block_size [%i] said error=%i,errno=%i
\n
"
,
min_size
,
blocksize
,
i
,
errno
);
if
((
i
!=
0
)
||
(
p
==
1
))
cond
=
0
;
else
p
=
p
/
2
;
/**
* first try SNDCTL_DSP_SETFRAGMENT
*/
if
(
min_size
>
blocksize
)
{
int
frag
=
(
2
<<
16
)
|
(
size_selector
);
if
(
ioctl
(
fd
,
SNDCTL_DSP_SETFRAGMENT
,
&
frag
)
==
-
1
)
{
ms_warning
(
"This OSS driver does not support trying subdivise"
,
SNDCTL_DSP_SETFRAGMENT
);
ioctl
(
fd
,
SNDCTL_DSP_GETBLKSIZE
,
&
min_size
);
/* try to subdivide BLKSIZE to reach block size if necessary */
if
(
min_size
>
blocksize
)
{
cond
=
1
;
p
=
min_size
/
blocksize
;
while
(
cond
)
{
i
=
ioctl
(
fd
,
SNDCTL_DSP_SUBDIVIDE
,
&
p
);
ms_message
(
"subdivide bloc min_size [%i] block_size [%i] said error=%i,errno=%i
\n
"
,
min_size
,
blocksize
,
i
,
errno
);
if
((
i
!=
0
)
||
(
p
==
1
))
cond
=
0
;
else
p
=
p
/
2
;
}
}
ioctl
(
fd
,
SNDCTL_DSP_GETBLKSIZE
,
&
min_size
);
}
else
{
/*it's working*/
min_size
=
1
<<
(
frag
&
0x0FFFF
);
ms_message
(
"Max fragment=%x, size selector=%x block size=%i"
,
frag
>>
16
,
frag
&
0x0FFFF
,
min_size
);
}
}
ioctl
(
fd
,
SNDCTL_DSP_GETBLKSIZE
,
&
min_size
);
if
(
min_size
>
blocksize
)
{
ms_warning
(
"dsp block size set to %i."
,
min_size
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment