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
508b0c9c
Commit
508b0c9c
authored
May 16, 2013
by
Andrew Eikum
Committed by
Alexandre Julliard
May 16, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Don't overrun capture buffer.
parent
b9921eb3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
capture.c
dlls/dsound/capture.c
+8
-3
No files found.
dlls/dsound/capture.c
View file @
508b0c9c
...
...
@@ -855,7 +855,7 @@ static void CALLBACK DSOUND_capture_timer(UINT timerID, UINT msg, DWORD_PTR user
DWORD_PTR
dw1
,
DWORD_PTR
dw2
)
{
DirectSoundCaptureDevice
*
device
=
(
DirectSoundCaptureDevice
*
)
user
;
UINT32
packet_frames
,
packet_bytes
,
avail_bytes
;
UINT32
packet_frames
,
packet_bytes
,
avail_bytes
,
skip_bytes
=
0
;
DWORD
flags
;
BYTE
*
buf
;
HRESULT
hr
;
...
...
@@ -888,18 +888,23 @@ static void CALLBACK DSOUND_capture_timer(UINT timerID, UINT msg, DWORD_PTR user
}
packet_bytes
=
packet_frames
*
device
->
pwfx
->
nBlockAlign
;
if
(
packet_bytes
>
device
->
buflen
){
TRACE
(
"audio glitch: dsound buffer too small for data
\n
"
);
skip_bytes
=
packet_bytes
-
device
->
buflen
;
packet_bytes
=
device
->
buflen
;
}
avail_bytes
=
device
->
buflen
-
device
->
write_pos_bytes
;
if
(
avail_bytes
>
packet_bytes
)
avail_bytes
=
packet_bytes
;
memcpy
(
device
->
buffer
+
device
->
write_pos_bytes
,
buf
,
avail_bytes
);
memcpy
(
device
->
buffer
+
device
->
write_pos_bytes
,
buf
+
skip_bytes
,
avail_bytes
);
capture_CheckNotify
(
device
->
capture_buffer
,
device
->
write_pos_bytes
,
avail_bytes
);
packet_bytes
-=
avail_bytes
;
if
(
packet_bytes
>
0
){
if
(
device
->
capture_buffer
->
flags
&
DSCBSTART_LOOPING
){
memcpy
(
device
->
buffer
,
buf
+
avail_bytes
,
packet_bytes
);
memcpy
(
device
->
buffer
,
buf
+
skip_bytes
+
avail_bytes
,
packet_bytes
);
capture_CheckNotify
(
device
->
capture_buffer
,
0
,
packet_bytes
);
}
else
{
device
->
state
=
STATE_STOPPED
;
...
...
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