Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
1ed42313
Commit
1ed42313
authored
Oct 11, 2011
by
Andrew Eikum
Committed by
Alexandre Julliard
Oct 12, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineoss.drv: Only write as much data as will fit into the OSS buffer.
parent
296b7956
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
15 deletions
+30
-15
mmdevdrv.c
dlls/wineoss.drv/mmdevdrv.c
+30
-15
No files found.
dlls/wineoss.drv/mmdevdrv.c
View file @
1ed42313
...
...
@@ -1253,51 +1253,66 @@ static void oss_silence_buffer(ACImpl *This, BYTE *buf, UINT32 frames)
static
void
oss_write_data
(
ACImpl
*
This
)
{
ssize_t
written
;
ssize_t
written
_bytes
;
UINT32
written_frames
;
size_t
to_write
;
size_t
to_write_frames
,
to_write_bytes
;
audio_buf_info
bi
;
BYTE
*
buf
=
This
->
local_buffer
+
(
This
->
lcl_offs_frames
*
This
->
fmt
->
nBlockAlign
);
if
(
This
->
lcl_offs_frames
+
This
->
held_frames
>
This
->
bufsize_frames
)
to_write
=
This
->
bufsize_frames
-
This
->
lcl_offs_frames
;
to_write
_frames
=
This
->
bufsize_frames
-
This
->
lcl_offs_frames
;
else
to_write
=
This
->
held_frames
;
to_write_frames
=
This
->
held_frames
;
to_write_bytes
=
to_write_frames
*
This
->
fmt
->
nBlockAlign
;
if
(
ioctl
(
This
->
fd
,
SNDCTL_DSP_GETOSPACE
,
&
bi
)
<
0
){
WARN
(
"GETOSPACE failed: %d (%s)
\n
"
,
errno
,
strerror
(
errno
));
return
;
}
if
(
bi
.
bytes
<
to_write_bytes
){
to_write_frames
=
bi
.
bytes
/
This
->
fmt
->
nBlockAlign
;
to_write_bytes
=
to_write_frames
*
This
->
fmt
->
nBlockAlign
;
}
if
(
This
->
session
->
mute
)
oss_silence_buffer
(
This
,
buf
,
to_write
);
oss_silence_buffer
(
This
,
buf
,
to_write
_frames
);
written
=
write
(
This
->
fd
,
buf
,
to_write
*
This
->
fmt
->
nBlockAlign
);
if
(
written
<
0
){
written
_bytes
=
write
(
This
->
fd
,
buf
,
to_write_bytes
);
if
(
written
_bytes
<
0
){
/* EAGAIN is OSS buffer full, log that too */
WARN
(
"write failed: %d (%s)
\n
"
,
errno
,
strerror
(
errno
));
return
;
}
written_frames
=
written
/
This
->
fmt
->
nBlockAlign
;
written_frames
=
written
_bytes
/
This
->
fmt
->
nBlockAlign
;
This
->
lcl_offs_frames
+=
written_frames
;
This
->
lcl_offs_frames
%=
This
->
bufsize_frames
;
This
->
held_frames
-=
written_frames
;
This
->
inbuf_frames
+=
written_frames
;
if
(
written_frames
<
to_write
){
if
(
written_frames
<
to_write
_frames
){
/* OSS buffer probably full */
return
;
}
if
(
This
->
held_frames
){
bi
.
bytes
-=
written_bytes
;
if
(
This
->
held_frames
&&
bi
.
bytes
>=
This
->
fmt
->
nBlockAlign
){
/* wrapped and have some data back at the start to write */
to_write_frames
=
bi
.
bytes
/
This
->
fmt
->
nBlockAlign
;
to_write_bytes
=
to_write_frames
*
This
->
fmt
->
nBlockAlign
;
if
(
This
->
session
->
mute
)
oss_silence_buffer
(
This
,
This
->
local_buffer
,
This
->
held
_frames
);
oss_silence_buffer
(
This
,
This
->
local_buffer
,
to_write
_frames
);
written
=
write
(
This
->
fd
,
This
->
local_buffer
,
This
->
held_frames
*
This
->
fmt
->
nBlockAlign
);
if
(
written
<
0
){
written_bytes
=
write
(
This
->
fd
,
This
->
local_buffer
,
to_write_bytes
);
if
(
written_bytes
<
0
){
WARN
(
"write failed: %d (%s)
\n
"
,
errno
,
strerror
(
errno
));
return
;
}
written_frames
=
written
/
This
->
fmt
->
nBlockAlign
;
written_frames
=
written
_bytes
/
This
->
fmt
->
nBlockAlign
;
This
->
lcl_offs_frames
+=
written_frames
;
This
->
lcl_offs_frames
%=
This
->
bufsize_frames
;
...
...
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