Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
38f9ba00
Commit
38f9ba00
authored
Dec 15, 2011
by
Jörg Höhle
Committed by
Alexandre Julliard
Dec 19, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mmdevapi: Enforce limits on period and duration.
parent
56f035b5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
30 deletions
+63
-30
mmdevdrv.c
dlls/winealsa.drv/mmdevdrv.c
+21
-10
mmdevdrv.c
dlls/winecoreaudio.drv/mmdevdrv.c
+21
-11
mmdevdrv.c
dlls/wineoss.drv/mmdevdrv.c
+21
-9
No files found.
dlls/winealsa.drv/mmdevdrv.c
View file @
38f9ba00
...
...
@@ -835,14 +835,28 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
return
E_INVALIDARG
;
}
if
(
mode
==
AUDCLNT_SHAREMODE_EXCLUSIVE
&&
flags
&
AUDCLNT_STREAMFLAGS_EVENTCALLBACK
){
FIXME
(
"EXCLUSIVE mode with EVENTCALLBACK
\n
"
);
return
AUDCLNT_E_DEVICE_IN_USE
;
if
(
mode
==
AUDCLNT_SHAREMODE_SHARED
){
period
=
DefaultPeriod
;
if
(
duration
<
3
*
period
)
duration
=
3
*
period
;
}
else
{
if
(
!
period
)
period
=
DefaultPeriod
;
/* not minimum */
if
(
period
<
MinimumPeriod
||
period
>
5000000
)
return
AUDCLNT_E_INVALID_DEVICE_PERIOD
;
if
(
duration
>
20000000
)
/* the smaller the period, the lower this limit */
return
AUDCLNT_E_BUFFER_SIZE_ERROR
;
if
(
flags
&
AUDCLNT_STREAMFLAGS_EVENTCALLBACK
){
if
(
duration
!=
period
)
return
AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL
;
FIXME
(
"EXCLUSIVE mode with EVENTCALLBACK
\n
"
);
return
AUDCLNT_E_DEVICE_IN_USE
;
}
else
{
if
(
duration
<
8
*
period
)
duration
=
8
*
period
;
/* may grow above 2s */
}
}
if
(
!
duration
)
duration
=
300000
;
/* 0.03s */
EnterCriticalSection
(
&
This
->
lock
);
if
(
This
->
initted
){
...
...
@@ -1001,10 +1015,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
goto
exit
;
}
if
(
period
)
This
->
mmdev_period_rt
=
period
;
else
This
->
mmdev_period_rt
=
DefaultPeriod
;
This
->
mmdev_period_rt
=
period
;
/* Check if the ALSA buffer is so small that it will run out before
* the next MMDevAPI period tick occurs. Allow a little wiggle room
...
...
dlls/winecoreaudio.drv/mmdevdrv.c
View file @
38f9ba00
...
...
@@ -961,9 +961,26 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
return
E_INVALIDARG
;
}
if
(
mode
==
AUDCLNT_SHAREMODE_EXCLUSIVE
&&
flags
&
AUDCLNT_STREAMFLAGS_EVENTCALLBACK
){
FIXME
(
"EXCLUSIVE mode with EVENTCALLBACK
\n
"
);
return
AUDCLNT_E_DEVICE_IN_USE
;
if
(
mode
==
AUDCLNT_SHAREMODE_SHARED
){
period
=
DefaultPeriod
;
if
(
duration
<
3
*
period
)
duration
=
3
*
period
;
}
else
{
if
(
!
period
)
period
=
DefaultPeriod
;
/* not minimum */
if
(
period
<
MinimumPeriod
||
period
>
5000000
)
return
AUDCLNT_E_INVALID_DEVICE_PERIOD
;
if
(
duration
>
20000000
)
/* the smaller the period, the lower this limit */
return
AUDCLNT_E_BUFFER_SIZE_ERROR
;
if
(
flags
&
AUDCLNT_STREAMFLAGS_EVENTCALLBACK
){
if
(
duration
!=
period
)
return
AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL
;
FIXME
(
"EXCLUSIVE mode with EVENTCALLBACK
\n
"
);
return
AUDCLNT_E_DEVICE_IN_USE
;
}
else
{
if
(
duration
<
8
*
period
)
duration
=
8
*
period
;
/* may grow above 2s */
}
}
OSSpinLockLock
(
&
This
->
lock
);
...
...
@@ -987,15 +1004,8 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
return
E_OUTOFMEMORY
;
}
if
(
period
){
This
->
period_ms
=
period
/
10000
;
if
(
This
->
period_ms
==
0
)
This
->
period_ms
=
1
;
}
else
This
->
period_ms
=
MinimumPeriod
/
10000
;
This
->
period_ms
=
period
/
10000
;
if
(
!
duration
)
duration
=
300000
;
/* 0.03s */
This
->
bufsize_frames
=
ceil
(
fmt
->
nSamplesPerSec
*
(
duration
/
10000000
.));
if
(
This
->
dataflow
==
eCapture
){
...
...
dlls/wineoss.drv/mmdevdrv.c
View file @
38f9ba00
...
...
@@ -906,9 +906,26 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
return
E_INVALIDARG
;
}
if
(
mode
==
AUDCLNT_SHAREMODE_EXCLUSIVE
&&
flags
&
AUDCLNT_STREAMFLAGS_EVENTCALLBACK
){
FIXME
(
"EXCLUSIVE mode with EVENTCALLBACK
\n
"
);
return
AUDCLNT_E_DEVICE_IN_USE
;
if
(
mode
==
AUDCLNT_SHAREMODE_SHARED
){
period
=
DefaultPeriod
;
if
(
duration
<
3
*
period
)
duration
=
3
*
period
;
}
else
{
if
(
!
period
)
period
=
DefaultPeriod
;
/* not minimum */
if
(
period
<
MinimumPeriod
||
period
>
5000000
)
return
AUDCLNT_E_INVALID_DEVICE_PERIOD
;
if
(
duration
>
20000000
)
/* the smaller the period, the lower this limit */
return
AUDCLNT_E_BUFFER_SIZE_ERROR
;
if
(
flags
&
AUDCLNT_STREAMFLAGS_EVENTCALLBACK
){
if
(
duration
!=
period
)
return
AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL
;
FIXME
(
"EXCLUSIVE mode with EVENTCALLBACK
\n
"
);
return
AUDCLNT_E_DEVICE_IN_USE
;
}
else
{
if
(
duration
<
8
*
period
)
duration
=
8
*
period
;
/* may grow above 2s */
}
}
EnterCriticalSection
(
&
This
->
lock
);
...
...
@@ -937,13 +954,8 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
return
E_OUTOFMEMORY
;
}
if
(
period
)
This
->
period_us
=
period
/
10
;
else
This
->
period_us
=
DefaultPeriod
/
10
;
This
->
period_us
=
period
/
10
;
if
(
!
duration
)
duration
=
300000
;
/* 0.03s */
This
->
bufsize_frames
=
ceil
(
fmt
->
nSamplesPerSec
*
(
duration
/
10000000
.));
This
->
local_buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
This
->
bufsize_frames
*
fmt
->
nBlockAlign
);
...
...
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