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
a5975bb6
Commit
a5975bb6
authored
Nov 12, 2013
by
Andrew Eikum
Committed by
Alexandre Julliard
Nov 12, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mmdevapi: Fill buffer with silence in IAudioRenderClient::GetBuffer.
parent
8c97327d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
28 deletions
+58
-28
render.c
dlls/mmdevapi/tests/render.c
+13
-2
mmdevdrv.c
dlls/winealsa.drv/mmdevdrv.c
+16
-6
mmdevdrv.c
dlls/winecoreaudio.drv/mmdevdrv.c
+15
-12
mmdevdrv.c
dlls/wineoss.drv/mmdevdrv.c
+14
-8
No files found.
dlls/mmdevapi/tests/render.c
View file @
a5975bb6
...
...
@@ -692,8 +692,8 @@ static void test_padding(void)
IAudioRenderClient
*
arc
;
WAVEFORMATEX
*
pwfx
;
REFERENCE_TIME
minp
,
defp
;
BYTE
*
buf
;
UINT32
psize
,
pad
,
written
;
BYTE
*
buf
,
silence
;
UINT32
psize
,
pad
,
written
,
i
;
hr
=
IMMDevice_Activate
(
dev
,
&
IID_IAudioClient
,
CLSCTX_INPROC_SERVER
,
NULL
,
(
void
**
)
&
ac
);
...
...
@@ -712,6 +712,11 @@ static void test_padding(void)
if
(
hr
!=
S_OK
)
return
;
if
(
pwfx
->
wBitsPerSample
==
8
)
silence
=
128
;
else
silence
=
0
;
/** GetDevicePeriod
* Default (= shared) device period is 10ms (e.g. 441 frames at 44100),
* except when the HW/OS forces a particular alignment,
...
...
@@ -738,6 +743,12 @@ static void test_padding(void)
hr
=
IAudioRenderClient_GetBuffer
(
arc
,
psize
,
&
buf
);
ok
(
hr
==
S_OK
,
"GetBuffer failed: %08x
\n
"
,
hr
);
ok
(
buf
!=
NULL
,
"NULL buffer returned
\n
"
);
for
(
i
=
0
;
i
<
psize
*
pwfx
->
nBlockAlign
;
++
i
){
if
(
buf
[
i
]
!=
silence
){
ok
(
0
,
"buffer has data in it already
\n
"
);
break
;
}
}
hr
=
IAudioRenderClient_GetBuffer
(
arc
,
0
,
&
buf
);
ok
(
hr
==
AUDCLNT_E_OUT_OF_ORDER
,
"GetBuffer 0 size failed: %08x
\n
"
,
hr
);
...
...
dlls/winealsa.drv/mmdevdrv.c
View file @
a5975bb6
...
...
@@ -2466,6 +2466,18 @@ static ULONG WINAPI AudioRenderClient_Release(IAudioRenderClient *iface)
return
AudioClient_Release
(
&
This
->
IAudioClient_iface
);
}
static
void
silence_buffer
(
ACImpl
*
This
,
BYTE
*
buffer
,
UINT32
frames
)
{
WAVEFORMATEXTENSIBLE
*
fmtex
=
(
WAVEFORMATEXTENSIBLE
*
)
This
->
fmt
;
if
((
This
->
fmt
->
wFormatTag
==
WAVE_FORMAT_PCM
||
(
This
->
fmt
->
wFormatTag
==
WAVE_FORMAT_EXTENSIBLE
&&
IsEqualGUID
(
&
fmtex
->
SubFormat
,
&
KSDATAFORMAT_SUBTYPE_PCM
)))
&&
This
->
fmt
->
wBitsPerSample
==
8
)
memset
(
buffer
,
128
,
frames
*
This
->
fmt
->
nBlockAlign
);
else
memset
(
buffer
,
0
,
frames
*
This
->
fmt
->
nBlockAlign
);
}
static
HRESULT
WINAPI
AudioRenderClient_GetBuffer
(
IAudioRenderClient
*
iface
,
UINT32
frames
,
BYTE
**
data
)
{
...
...
@@ -2515,6 +2527,8 @@ static HRESULT WINAPI AudioRenderClient_GetBuffer(IAudioRenderClient *iface,
This
->
getbuf_last
=
frames
;
}
silence_buffer
(
This
,
*
data
,
frames
);
LeaveCriticalSection
(
&
This
->
lock
);
return
S_OK
;
...
...
@@ -2568,12 +2582,8 @@ static HRESULT WINAPI AudioRenderClient_ReleaseBuffer(
else
buffer
=
This
->
tmp_buffer
;
if
(
flags
&
AUDCLNT_BUFFERFLAGS_SILENT
){
if
(
This
->
fmt
->
wBitsPerSample
==
8
)
memset
(
buffer
,
128
,
written_frames
*
This
->
fmt
->
nBlockAlign
);
else
memset
(
buffer
,
0
,
written_frames
*
This
->
fmt
->
nBlockAlign
);
}
if
(
flags
&
AUDCLNT_BUFFERFLAGS_SILENT
)
silence_buffer
(
This
,
buffer
,
written_frames
);
if
(
This
->
getbuf_last
<
0
)
alsa_wrap_buffer
(
This
,
buffer
,
written_frames
);
...
...
dlls/winecoreaudio.drv/mmdevdrv.c
View file @
a5975bb6
...
...
@@ -2024,6 +2024,18 @@ static ULONG WINAPI AudioRenderClient_Release(IAudioRenderClient *iface)
return
AudioClient_Release
(
&
This
->
IAudioClient_iface
);
}
static
void
silence_buffer
(
ACImpl
*
This
,
BYTE
*
buffer
,
UINT32
frames
)
{
WAVEFORMATEXTENSIBLE
*
fmtex
=
(
WAVEFORMATEXTENSIBLE
*
)
This
->
fmt
;
if
((
This
->
fmt
->
wFormatTag
==
WAVE_FORMAT_PCM
||
(
This
->
fmt
->
wFormatTag
==
WAVE_FORMAT_EXTENSIBLE
&&
IsEqualGUID
(
&
fmtex
->
SubFormat
,
&
KSDATAFORMAT_SUBTYPE_PCM
)))
&&
This
->
fmt
->
wBitsPerSample
==
8
)
memset
(
buffer
,
128
,
frames
*
This
->
fmt
->
nBlockAlign
);
else
memset
(
buffer
,
0
,
frames
*
This
->
fmt
->
nBlockAlign
);
}
static
HRESULT
WINAPI
AudioRenderClient_GetBuffer
(
IAudioRenderClient
*
iface
,
UINT32
frames
,
BYTE
**
data
)
{
...
...
@@ -2094,6 +2106,7 @@ static HRESULT WINAPI AudioRenderClient_GetBuffer(IAudioRenderClient *iface,
This
->
getbuf_last
=
frames
;
*
data
=
This
->
public_buffer
->
mAudioData
;
silence_buffer
(
This
,
*
data
,
frames
);
OSSpinLockUnlock
(
&
This
->
lock
);
...
...
@@ -2133,18 +2146,8 @@ static HRESULT WINAPI AudioRenderClient_ReleaseBuffer(
return
AUDCLNT_E_INVALID_SIZE
;
}
if
(
flags
&
AUDCLNT_BUFFERFLAGS_SILENT
){
WAVEFORMATEXTENSIBLE
*
fmtex
=
(
WAVEFORMATEXTENSIBLE
*
)
This
->
fmt
;
if
((
This
->
fmt
->
wFormatTag
==
WAVE_FORMAT_PCM
||
(
This
->
fmt
->
wFormatTag
==
WAVE_FORMAT_EXTENSIBLE
&&
IsEqualGUID
(
&
fmtex
->
SubFormat
,
&
KSDATAFORMAT_SUBTYPE_PCM
)))
&&
This
->
fmt
->
wBitsPerSample
==
8
)
memset
(
This
->
public_buffer
->
mAudioData
,
128
,
frames
*
This
->
fmt
->
nBlockAlign
);
else
memset
(
This
->
public_buffer
->
mAudioData
,
0
,
frames
*
This
->
fmt
->
nBlockAlign
);
}
if
(
flags
&
AUDCLNT_BUFFERFLAGS_SILENT
)
silence_buffer
(
This
,
This
->
public_buffer
->
mAudioData
,
frames
);
This
->
public_buffer
->
mAudioDataByteSize
=
frames
*
This
->
fmt
->
nBlockAlign
;
...
...
dlls/wineoss.drv/mmdevdrv.c
View file @
a5975bb6
...
...
@@ -1367,12 +1367,16 @@ static HRESULT WINAPI AudioClient_GetDevicePeriod(IAudioClient *iface,
return
S_OK
;
}
static
void
oss_silence_buffer
(
ACImpl
*
This
,
BYTE
*
buf
,
UINT32
frames
)
{
if
(
This
->
fmt
->
wBitsPerSample
==
8
)
memset
(
buf
,
128
,
frames
*
This
->
fmt
->
nBlockAlign
);
static
void
silence_buffer
(
ACImpl
*
This
,
BYTE
*
buffer
,
UINT32
frames
)
{
WAVEFORMATEXTENSIBLE
*
fmtex
=
(
WAVEFORMATEXTENSIBLE
*
)
This
->
fmt
;
if
((
This
->
fmt
->
wFormatTag
==
WAVE_FORMAT_PCM
||
(
This
->
fmt
->
wFormatTag
==
WAVE_FORMAT_EXTENSIBLE
&&
IsEqualGUID
(
&
fmtex
->
SubFormat
,
&
KSDATAFORMAT_SUBTYPE_PCM
)))
&&
This
->
fmt
->
wBitsPerSample
==
8
)
memset
(
buffer
,
128
,
frames
*
This
->
fmt
->
nBlockAlign
);
else
memset
(
buf
,
0
,
frames
*
This
->
fmt
->
nBlockAlign
);
memset
(
buf
fer
,
0
,
frames
*
This
->
fmt
->
nBlockAlign
);
}
static
void
oss_write_data
(
ACImpl
*
This
)
...
...
@@ -1419,7 +1423,7 @@ static void oss_write_data(ACImpl *This)
to_write_bytes
=
to_write_frames
*
This
->
fmt
->
nBlockAlign
;
if
(
This
->
session
->
mute
)
oss_
silence_buffer
(
This
,
buf
,
to_write_frames
);
silence_buffer
(
This
,
buf
,
to_write_frames
);
written_bytes
=
write
(
This
->
fd
,
buf
,
to_write_bytes
);
if
(
written_bytes
<
0
){
...
...
@@ -1445,7 +1449,7 @@ static void oss_write_data(ACImpl *This)
to_write_bytes
=
to_write_frames
*
This
->
fmt
->
nBlockAlign
;
if
(
This
->
session
->
mute
)
oss_
silence_buffer
(
This
,
This
->
local_buffer
,
to_write_frames
);
silence_buffer
(
This
,
This
->
local_buffer
,
to_write_frames
);
written_bytes
=
write
(
This
->
fd
,
This
->
local_buffer
,
to_write_bytes
);
if
(
written_bytes
<
0
){
...
...
@@ -1846,6 +1850,8 @@ static HRESULT WINAPI AudioRenderClient_GetBuffer(IAudioRenderClient *iface,
This
->
getbuf_last
=
frames
;
}
silence_buffer
(
This
,
*
data
,
frames
);
LeaveCriticalSection
(
&
This
->
lock
);
return
S_OK
;
...
...
@@ -1902,7 +1908,7 @@ static HRESULT WINAPI AudioRenderClient_ReleaseBuffer(
buffer
=
This
->
tmp_buffer
;
if
(
flags
&
AUDCLNT_BUFFERFLAGS_SILENT
)
oss_
silence_buffer
(
This
,
buffer
,
written_frames
);
silence_buffer
(
This
,
buffer
,
written_frames
);
if
(
This
->
getbuf_last
<
0
)
oss_wrap_buffer
(
This
,
buffer
,
written_frames
);
...
...
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