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
ee5f6f22
Commit
ee5f6f22
authored
Aug 21, 2011
by
Jörg Höhle
Committed by
Alexandre Julliard
Jan 13, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winecoreaudio: Fix AudioCaptureClient Get/ReleaseBuffer protocol.
parent
04cf4dc0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
21 deletions
+35
-21
mmdevdrv.c
dlls/winecoreaudio.drv/mmdevdrv.c
+35
-21
No files found.
dlls/winecoreaudio.drv/mmdevdrv.c
View file @
ee5f6f22
...
...
@@ -1950,32 +1950,38 @@ static HRESULT WINAPI AudioCaptureClient_GetBuffer(IAudioCaptureClient *iface,
}
if
(
This
->
public_buffer
){
*
data
=
This
->
public_buffer
->
mAudioData
;
*
frames
=
This
->
public_buffer
->
mAudioDataByteSize
/
This
->
fmt
->
nBlockAlign
;
}
else
{
struct
list
*
head
=
list_head
(
&
This
->
avail_buffers
);
if
(
!
head
){
*
data
=
NULL
;
*
frames
=
0
;
}
else
{
AQBuffer
*
buf
=
LIST_ENTRY
(
head
,
AQBuffer
,
entry
);
This
->
public_buffer
=
buf
->
buf
;
*
data
=
This
->
public_buffer
->
mAudioData
;
*
frames
=
This
->
public_buffer
->
mAudioDataByteSize
/
This
->
fmt
->
nBlockAlign
;
list_remove
(
&
buf
->
entry
);
if
(
!*
frames
){
OSStatus
sc
=
AudioQueueEnqueueBuffer
(
This
->
aqueue
,
This
->
public_buffer
,
0
,
NULL
);
if
(
sc
!=
noErr
)
ERR
(
"Unable to enqueue buffer: %lx
\n
"
,
sc
);
This
->
public_buffer
=
NULL
;
WARN
(
"empty packet
\n
"
);
}
}
}
*
flags
=
0
;
This
->
written_frames
+=
*
frames
;
This
->
inbuf_frames
-=
*
frames
;
This
->
getbuf_last
=
1
;
if
(
devpos
||
qpcpos
)
AudioClock_GetPosition_nolock
(
This
,
devpos
,
qpcpos
);
if
((
This
->
getbuf_last
=
*
frames
)){
UINT64
pos
;
*
flags
=
0
;
*
data
=
This
->
public_buffer
->
mAudioData
;
if
(
devpos
)
*
devpos
=
This
->
written_frames
;
if
(
qpcpos
)
/* fixme: qpc of recording time */
AudioClock_GetPosition_nolock
(
This
,
&
pos
,
qpcpos
);
}
OSSpinLockUnlock
(
&
This
->
lock
);
return
*
frames
?
S_OK
:
AUDCLNT_S_BUFFER_EMPTY
;
...
...
@@ -1985,34 +1991,42 @@ static HRESULT WINAPI AudioCaptureClient_ReleaseBuffer(
IAudioCaptureClient
*
iface
,
UINT32
done
)
{
ACImpl
*
This
=
impl_from_IAudioCaptureClient
(
iface
);
UINT32
pbuf_frames
;
OSStatus
sc
;
TRACE
(
"(%p)->(%u)
\n
"
,
This
,
done
);
OSSpinLockLock
(
&
This
->
lock
);
if
(
!
done
){
This
->
getbuf_last
=
0
;
OSSpinLockUnlock
(
&
This
->
lock
);
return
S_OK
;
}
if
(
!
This
->
getbuf_last
){
OSSpinLockUnlock
(
&
This
->
lock
);
return
AUDCLNT_E_OUT_OF_ORDER
;
}
pbuf_frames
=
This
->
public_buffer
->
mAudioDataByteSize
/
This
->
fmt
->
nBlockAlign
;
if
(
done
!=
0
&&
done
!=
pbuf_frames
){
if
(
This
->
getbuf_last
!=
done
){
OSSpinLockUnlock
(
&
This
->
lock
);
return
AUDCLNT_E_INVALID_SIZE
;
}
if
(
done
){
sc
=
AudioQueueEnqueueBuffer
(
This
->
aqueue
,
This
->
public_buffer
,
0
,
NULL
);
if
(
sc
!=
noErr
)
WARN
(
"Unable to enqueue buffer: %lx
\n
"
,
sc
);
This
->
public_buffer
=
NULL
;
}
This
->
written_frames
+=
done
;
This
->
inbuf_frames
-=
done
;
This
->
getbuf_last
=
0
;
sc
=
AudioQueueEnqueueBuffer
(
This
->
aqueue
,
This
->
public_buffer
,
0
,
NULL
);
if
(
sc
!=
noErr
){
OSSpinLockUnlock
(
&
This
->
lock
);
/* fixme: can't zero public_buffer or we lose memory, but then
* GetBuffer will see that packet again and again. */
ERR
(
"Unable to enqueue buffer: %lx
\n
"
,
sc
);
return
AUDCLNT_E_DEVICE_INVALIDATED
;
}
This
->
public_buffer
=
NULL
;
OSSpinLockUnlock
(
&
This
->
lock
);
return
S_OK
;
...
...
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