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
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
20 deletions
+34
-20
mmdevdrv.c
dlls/winecoreaudio.drv/mmdevdrv.c
+34
-20
No files found.
dlls/winecoreaudio.drv/mmdevdrv.c
View file @
ee5f6f22
...
@@ -1950,32 +1950,38 @@ static HRESULT WINAPI AudioCaptureClient_GetBuffer(IAudioCaptureClient *iface,
...
@@ -1950,32 +1950,38 @@ static HRESULT WINAPI AudioCaptureClient_GetBuffer(IAudioCaptureClient *iface,
}
}
if
(
This
->
public_buffer
){
if
(
This
->
public_buffer
){
*
data
=
This
->
public_buffer
->
mAudioData
;
*
frames
=
*
frames
=
This
->
public_buffer
->
mAudioDataByteSize
/
This
->
fmt
->
nBlockAlign
;
This
->
public_buffer
->
mAudioDataByteSize
/
This
->
fmt
->
nBlockAlign
;
}
else
{
}
else
{
struct
list
*
head
=
list_head
(
&
This
->
avail_buffers
);
struct
list
*
head
=
list_head
(
&
This
->
avail_buffers
);
if
(
!
head
){
if
(
!
head
){
*
data
=
NULL
;
*
frames
=
0
;
*
frames
=
0
;
}
else
{
}
else
{
AQBuffer
*
buf
=
LIST_ENTRY
(
head
,
AQBuffer
,
entry
);
AQBuffer
*
buf
=
LIST_ENTRY
(
head
,
AQBuffer
,
entry
);
This
->
public_buffer
=
buf
->
buf
;
This
->
public_buffer
=
buf
->
buf
;
*
data
=
This
->
public_buffer
->
mAudioData
;
*
frames
=
*
frames
=
This
->
public_buffer
->
mAudioDataByteSize
/
This
->
fmt
->
nBlockAlign
;
This
->
public_buffer
->
mAudioDataByteSize
/
This
->
fmt
->
nBlockAlign
;
list_remove
(
&
buf
->
entry
);
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
"
);
}
}
}
}
}
if
((
This
->
getbuf_last
=
*
frames
)){
UINT64
pos
;
*
flags
=
0
;
*
flags
=
0
;
This
->
written_frames
+=
*
frames
;
*
data
=
This
->
public_buffer
->
mAudioData
;
This
->
inbuf_frames
-=
*
frames
;
This
->
getbuf_last
=
1
;
if
(
devpos
||
qpcpos
)
AudioClock_GetPosition_nolock
(
This
,
devpos
,
qpcpos
);
if
(
devpos
)
*
devpos
=
This
->
written_frames
;
if
(
qpcpos
)
/* fixme: qpc of recording time */
AudioClock_GetPosition_nolock
(
This
,
&
pos
,
qpcpos
);
}
OSSpinLockUnlock
(
&
This
->
lock
);
OSSpinLockUnlock
(
&
This
->
lock
);
return
*
frames
?
S_OK
:
AUDCLNT_S_BUFFER_EMPTY
;
return
*
frames
?
S_OK
:
AUDCLNT_S_BUFFER_EMPTY
;
...
@@ -1985,34 +1991,42 @@ static HRESULT WINAPI AudioCaptureClient_ReleaseBuffer(
...
@@ -1985,34 +1991,42 @@ static HRESULT WINAPI AudioCaptureClient_ReleaseBuffer(
IAudioCaptureClient
*
iface
,
UINT32
done
)
IAudioCaptureClient
*
iface
,
UINT32
done
)
{
{
ACImpl
*
This
=
impl_from_IAudioCaptureClient
(
iface
);
ACImpl
*
This
=
impl_from_IAudioCaptureClient
(
iface
);
UINT32
pbuf_frames
;
OSStatus
sc
;
OSStatus
sc
;
TRACE
(
"(%p)->(%u)
\n
"
,
This
,
done
);
TRACE
(
"(%p)->(%u)
\n
"
,
This
,
done
);
OSSpinLockLock
(
&
This
->
lock
);
OSSpinLockLock
(
&
This
->
lock
);
if
(
!
done
){
This
->
getbuf_last
=
0
;
OSSpinLockUnlock
(
&
This
->
lock
);
return
S_OK
;
}
if
(
!
This
->
getbuf_last
){
if
(
!
This
->
getbuf_last
){
OSSpinLockUnlock
(
&
This
->
lock
);
OSSpinLockUnlock
(
&
This
->
lock
);
return
AUDCLNT_E_OUT_OF_ORDER
;
return
AUDCLNT_E_OUT_OF_ORDER
;
}
}
pbuf_frames
=
This
->
public_buffer
->
mAudioDataByteSize
/
This
->
fmt
->
nBlockAlign
;
if
(
This
->
getbuf_last
!=
done
){
if
(
done
!=
0
&&
done
!=
pbuf_frames
){
OSSpinLockUnlock
(
&
This
->
lock
);
OSSpinLockUnlock
(
&
This
->
lock
);
return
AUDCLNT_E_INVALID_SIZE
;
return
AUDCLNT_E_INVALID_SIZE
;
}
}
if
(
done
){
This
->
written_frames
+=
done
;
sc
=
AudioQueueEnqueueBuffer
(
This
->
aqueue
,
This
->
public_buffer
,
This
->
inbuf_frames
-=
done
;
0
,
NULL
);
if
(
sc
!=
noErr
)
WARN
(
"Unable to enqueue buffer: %lx
\n
"
,
sc
);
This
->
public_buffer
=
NULL
;
}
This
->
getbuf_last
=
0
;
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
);
OSSpinLockUnlock
(
&
This
->
lock
);
return
S_OK
;
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