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
89eaa56a
Commit
89eaa56a
authored
Jan 09, 2012
by
Jörg Höhle
Committed by
Alexandre Julliard
Jan 16, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winecoreaudio: GetNextPacketSize returns 0 when no data is available yet.
parent
18024afd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
34 deletions
+40
-34
mmdevdrv.c
dlls/winecoreaudio.drv/mmdevdrv.c
+40
-34
No files found.
dlls/winecoreaudio.drv/mmdevdrv.c
View file @
89eaa56a
...
...
@@ -1930,11 +1930,44 @@ static ULONG WINAPI AudioCaptureClient_Release(IAudioCaptureClient *iface)
return
IAudioClient_Release
(
&
This
->
IAudioClient_iface
);
}
static
HRESULT
AudioCaptureClient_GetNextPacket
(
ACImpl
*
This
,
UINT32
*
frames
)
{
OSStatus
sc
;
for
(;;){
if
(
!
This
->
public_buffer
){
struct
list
*
head
=
list_head
(
&
This
->
avail_buffers
);
AQBuffer
*
buf
;
if
(
!
head
){
*
frames
=
0
;
return
S_OK
;
}
buf
=
LIST_ENTRY
(
head
,
AQBuffer
,
entry
);
This
->
public_buffer
=
buf
->
buf
;
list_remove
(
&
buf
->
entry
);
}
*
frames
=
This
->
public_buffer
->
mAudioDataByteSize
/
This
->
fmt
->
nBlockAlign
;
if
(
*
frames
)
return
S_OK
;
WARN
(
"empty packet
\n
"
);
/* fixme: for reasons not yet understood, the initially submitted
* packets are returned with 0 bytes. Resubmit them. */
sc
=
AudioQueueEnqueueBuffer
(
This
->
aqueue
,
This
->
public_buffer
,
0
,
NULL
);
if
(
sc
!=
noErr
){
ERR
(
"Unable to enqueue buffer: %lx
\n
"
,
sc
);
/* Release will free This->public_buffer */
return
AUDCLNT_E_DEVICE_INVALIDATED
;
}
else
This
->
public_buffer
=
NULL
;
}
}
static
HRESULT
WINAPI
AudioCaptureClient_GetBuffer
(
IAudioCaptureClient
*
iface
,
BYTE
**
data
,
UINT32
*
frames
,
DWORD
*
flags
,
UINT64
*
devpos
,
UINT64
*
qpcpos
)
{
ACImpl
*
This
=
impl_from_IAudioCaptureClient
(
iface
);
HRESULT
hr
;
TRACE
(
"(%p)->(%p, %p, %p, %p, %p)
\n
"
,
This
,
data
,
frames
,
flags
,
devpos
,
qpcpos
);
...
...
@@ -1949,27 +1982,10 @@ static HRESULT WINAPI AudioCaptureClient_GetBuffer(IAudioCaptureClient *iface,
return
AUDCLNT_E_OUT_OF_ORDER
;
}
if
(
This
->
public_buffer
){
*
frames
=
This
->
public_buffer
->
mAudioDataByteSize
/
This
->
fmt
->
nBlockAlign
;
}
else
{
struct
list
*
head
=
list_head
(
&
This
->
avail_buffers
);
if
(
!
head
){
*
frames
=
0
;
}
else
{
AQBuffer
*
buf
=
LIST_ENTRY
(
head
,
AQBuffer
,
entry
);
This
->
public_buffer
=
buf
->
buf
;
*
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
"
);
}
}
hr
=
AudioCaptureClient_GetNextPacket
(
This
,
frames
);
if
(
FAILED
(
hr
)){
OSSpinLockUnlock
(
&
This
->
lock
);
return
hr
;
}
if
((
This
->
getbuf_last
=
*
frames
)){
...
...
@@ -2036,8 +2052,7 @@ static HRESULT WINAPI AudioCaptureClient_GetNextPacketSize(
IAudioCaptureClient
*
iface
,
UINT32
*
frames
)
{
ACImpl
*
This
=
impl_from_IAudioCaptureClient
(
iface
);
struct
list
*
head
;
AQBuffer
*
buf
;
HRESULT
hr
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
frames
);
...
...
@@ -2046,20 +2061,11 @@ static HRESULT WINAPI AudioCaptureClient_GetNextPacketSize(
OSSpinLockLock
(
&
This
->
lock
);
head
=
list_head
(
&
This
->
avail_buffers
);
if
(
!
head
){
*
frames
=
This
->
bufsize_frames
/
CAPTURE_BUFFERS
;
OSSpinLockUnlock
(
&
This
->
lock
);
return
S_OK
;
}
buf
=
LIST_ENTRY
(
head
,
AQBuffer
,
entry
);
*
frames
=
buf
->
buf
->
mAudioDataByteSize
/
This
->
fmt
->
nBlockAlign
;
hr
=
AudioCaptureClient_GetNextPacket
(
This
,
frames
);
OSSpinLockUnlock
(
&
This
->
lock
);
return
S_OK
;
return
hr
;
}
static
const
IAudioCaptureClientVtbl
AudioCaptureClient_Vtbl
=
...
...
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