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
18024afd
Commit
18024afd
authored
Jan 08, 2012
by
Jörg Höhle
Committed by
Alexandre Julliard
Jan 16, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winealsa: Fix AudioCaptureClient Get/ReleaseBuffer protocol.
parent
8bf8bd97
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
22 deletions
+41
-22
mmdevdrv.c
dlls/winealsa.drv/mmdevdrv.c
+41
-22
No files found.
dlls/winealsa.drv/mmdevdrv.c
View file @
18024afd
...
@@ -115,7 +115,6 @@ struct ACImpl {
...
@@ -115,7 +115,6 @@ struct ACImpl {
HANDLE
timer
;
HANDLE
timer
;
BYTE
*
local_buffer
,
*
tmp_buffer
;
BYTE
*
local_buffer
,
*
tmp_buffer
;
int
buf_state
;
long
getbuf_last
;
/* <0 when using tmp_buffer */
long
getbuf_last
;
/* <0 when using tmp_buffer */
CRITICAL_SECTION
lock
;
CRITICAL_SECTION
lock
;
...
@@ -126,12 +125,6 @@ struct ACImpl {
...
@@ -126,12 +125,6 @@ struct ACImpl {
struct
list
entry
;
struct
list
entry
;
};
};
enum
BufferStates
{
NOT_LOCKED
=
0
,
LOCKED_NORMAL
,
/* public buffer piece is from local_buffer */
LOCKED_WRAPPED
/* public buffer piece is wrapped around, in tmp_buffer */
};
typedef
struct
_SessionMgr
{
typedef
struct
_SessionMgr
{
IAudioSessionManager2
IAudioSessionManager2_iface
;
IAudioSessionManager2
IAudioSessionManager2_iface
;
...
@@ -1757,7 +1750,7 @@ static HRESULT WINAPI AudioClient_Reset(IAudioClient *iface)
...
@@ -1757,7 +1750,7 @@ static HRESULT WINAPI AudioClient_Reset(IAudioClient *iface)
return
AUDCLNT_E_NOT_STOPPED
;
return
AUDCLNT_E_NOT_STOPPED
;
}
}
if
(
This
->
buf_state
!=
NOT_LOCKED
||
This
->
getbuf_last
){
if
(
This
->
getbuf_last
){
LeaveCriticalSection
(
&
This
->
lock
);
LeaveCriticalSection
(
&
This
->
lock
);
return
AUDCLNT_E_BUFFER_OPERATION_PENDING
;
return
AUDCLNT_E_BUFFER_OPERATION_PENDING
;
}
}
...
@@ -2127,7 +2120,6 @@ static HRESULT WINAPI AudioCaptureClient_GetBuffer(IAudioCaptureClient *iface,
...
@@ -2127,7 +2120,6 @@ static HRESULT WINAPI AudioCaptureClient_GetBuffer(IAudioCaptureClient *iface,
UINT64
*
qpcpos
)
UINT64
*
qpcpos
)
{
{
ACImpl
*
This
=
impl_from_IAudioCaptureClient
(
iface
);
ACImpl
*
This
=
impl_from_IAudioCaptureClient
(
iface
);
HRESULT
hr
;
TRACE
(
"(%p)->(%p, %p, %p, %p, %p)
\n
"
,
This
,
data
,
frames
,
flags
,
TRACE
(
"(%p)->(%p, %p, %p, %p, %p)
\n
"
,
This
,
data
,
frames
,
flags
,
devpos
,
qpcpos
);
devpos
,
qpcpos
);
...
@@ -2137,18 +2129,18 @@ static HRESULT WINAPI AudioCaptureClient_GetBuffer(IAudioCaptureClient *iface,
...
@@ -2137,18 +2129,18 @@ static HRESULT WINAPI AudioCaptureClient_GetBuffer(IAudioCaptureClient *iface,
EnterCriticalSection
(
&
This
->
lock
);
EnterCriticalSection
(
&
This
->
lock
);
if
(
This
->
buf_state
!=
NOT_LOCKED
){
if
(
This
->
getbuf_last
){
LeaveCriticalSection
(
&
This
->
lock
);
LeaveCriticalSection
(
&
This
->
lock
);
return
AUDCLNT_E_OUT_OF_ORDER
;
return
AUDCLNT_E_OUT_OF_ORDER
;
}
}
hr
=
IAudioCaptureClient_GetNextPacketSize
(
iface
,
frames
);
/* hr = GetNextPacketSize(iface, frames); */
if
(
FAILED
(
hr
)){
if
(
This
->
held_frames
<
This
->
mmdev_period_frames
){
*
frames
=
0
;
LeaveCriticalSection
(
&
This
->
lock
);
LeaveCriticalSection
(
&
This
->
lock
);
return
hr
;
return
AUDCLNT_S_BUFFER_EMPTY
;
}
}
*
frames
=
This
->
mmdev_period_frames
;
*
flags
=
0
;
if
(
This
->
lcl_offs_frames
+
*
frames
>
This
->
bufsize_frames
){
if
(
This
->
lcl_offs_frames
+
*
frames
>
This
->
bufsize_frames
){
UINT32
chunk_bytes
,
offs_bytes
,
frames_bytes
;
UINT32
chunk_bytes
,
offs_bytes
,
frames_bytes
;
...
@@ -2175,10 +2167,17 @@ static HRESULT WINAPI AudioCaptureClient_GetBuffer(IAudioCaptureClient *iface,
...
@@ -2175,10 +2167,17 @@ static HRESULT WINAPI AudioCaptureClient_GetBuffer(IAudioCaptureClient *iface,
*
data
=
This
->
local_buffer
+
*
data
=
This
->
local_buffer
+
This
->
lcl_offs_frames
*
This
->
fmt
->
nBlockAlign
;
This
->
lcl_offs_frames
*
This
->
fmt
->
nBlockAlign
;
This
->
buf_state
=
LOCKED_NORMAL
;
This
->
getbuf_last
=
*
frames
;
*
flags
=
0
;
if
(
devpos
||
qpcpos
)
if
(
devpos
)
IAudioClock_GetPosition
(
&
This
->
IAudioClock_iface
,
devpos
,
qpcpos
);
*
devpos
=
This
->
written_frames
;
if
(
qpcpos
){
/* fixme: qpc of recording time */
LARGE_INTEGER
stamp
,
freq
;
QueryPerformanceCounter
(
&
stamp
);
QueryPerformanceFrequency
(
&
freq
);
*
qpcpos
=
(
stamp
.
QuadPart
*
(
INT64
)
10000000
)
/
freq
.
QuadPart
;
}
LeaveCriticalSection
(
&
This
->
lock
);
LeaveCriticalSection
(
&
This
->
lock
);
...
@@ -2194,16 +2193,27 @@ static HRESULT WINAPI AudioCaptureClient_ReleaseBuffer(
...
@@ -2194,16 +2193,27 @@ static HRESULT WINAPI AudioCaptureClient_ReleaseBuffer(
EnterCriticalSection
(
&
This
->
lock
);
EnterCriticalSection
(
&
This
->
lock
);
if
(
This
->
buf_state
==
NOT_LOCKED
){
if
(
!
done
){
This
->
getbuf_last
=
0
;
LeaveCriticalSection
(
&
This
->
lock
);
return
S_OK
;
}
if
(
!
This
->
getbuf_last
){
LeaveCriticalSection
(
&
This
->
lock
);
LeaveCriticalSection
(
&
This
->
lock
);
return
AUDCLNT_E_OUT_OF_ORDER
;
return
AUDCLNT_E_OUT_OF_ORDER
;
}
}
if
(
This
->
getbuf_last
!=
done
){
LeaveCriticalSection
(
&
This
->
lock
);
return
AUDCLNT_E_INVALID_SIZE
;
}
This
->
written_frames
+=
done
;
This
->
held_frames
-=
done
;
This
->
held_frames
-=
done
;
This
->
lcl_offs_frames
+=
done
;
This
->
lcl_offs_frames
+=
done
;
This
->
lcl_offs_frames
%=
This
->
bufsize_frames
;
This
->
lcl_offs_frames
%=
This
->
bufsize_frames
;
This
->
getbuf_last
=
0
;
This
->
buf_state
=
NOT_LOCKED
;
LeaveCriticalSection
(
&
This
->
lock
);
LeaveCriticalSection
(
&
This
->
lock
);
...
@@ -2217,7 +2227,16 @@ static HRESULT WINAPI AudioCaptureClient_GetNextPacketSize(
...
@@ -2217,7 +2227,16 @@ static HRESULT WINAPI AudioCaptureClient_GetNextPacketSize(
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
frames
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
frames
);
return
AudioClient_GetCurrentPadding
(
&
This
->
IAudioClient_iface
,
frames
);
if
(
!
frames
)
return
E_POINTER
;
EnterCriticalSection
(
&
This
->
lock
);
*
frames
=
This
->
held_frames
<
This
->
mmdev_period_frames
?
0
:
This
->
mmdev_period_frames
;
LeaveCriticalSection
(
&
This
->
lock
);
return
S_OK
;
}
}
static
const
IAudioCaptureClientVtbl
AudioCaptureClient_Vtbl
=
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