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
8870fe38
Commit
8870fe38
authored
Sep 07, 2009
by
Jörg Höhle
Committed by
Alexandre Julliard
Sep 16, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineoss: Enforce invariant about BlockAlign and nAvgBytesPerSec.
parent
bdb73f5c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
15 deletions
+20
-15
audio.c
dlls/wineoss.drv/audio.c
+20
-15
No files found.
dlls/wineoss.drv/audio.c
View file @
8870fe38
...
...
@@ -1990,6 +1990,16 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
return
MMSYSERR_NOERROR
;
}
/* nBlockAlign and nAvgBytesPerSec are output variables for dsound */
if
(
lpDesc
->
lpFormat
->
nBlockAlign
!=
lpDesc
->
lpFormat
->
nChannels
*
lpDesc
->
lpFormat
->
wBitsPerSample
/
8
)
{
lpDesc
->
lpFormat
->
nBlockAlign
=
lpDesc
->
lpFormat
->
nChannels
*
lpDesc
->
lpFormat
->
wBitsPerSample
/
8
;
WARN
(
"Fixing nBlockAlign
\n
"
);
}
if
(
lpDesc
->
lpFormat
->
nAvgBytesPerSec
!=
lpDesc
->
lpFormat
->
nSamplesPerSec
*
lpDesc
->
lpFormat
->
nBlockAlign
)
{
lpDesc
->
lpFormat
->
nAvgBytesPerSec
=
lpDesc
->
lpFormat
->
nSamplesPerSec
*
lpDesc
->
lpFormat
->
nBlockAlign
;
WARN
(
"Fixing nAvgBytesPerSec
\n
"
);
}
TRACE
(
"OSS_OpenDevice requested this format: %dx%dx%d %s
\n
"
,
lpDesc
->
lpFormat
->
nSamplesPerSec
,
lpDesc
->
lpFormat
->
wBitsPerSample
,
...
...
@@ -2064,13 +2074,6 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
wwo
->
waveDesc
=
*
lpDesc
;
copy_format
(
lpDesc
->
lpFormat
,
&
wwo
->
waveFormat
);
if
(
wwo
->
waveFormat
.
Format
.
wBitsPerSample
==
0
)
{
WARN
(
"Resetting zeroed wBitsPerSample
\n
"
);
wwo
->
waveFormat
.
Format
.
wBitsPerSample
=
8
*
(
wwo
->
waveFormat
.
Format
.
nAvgBytesPerSec
/
wwo
->
waveFormat
.
Format
.
nSamplesPerSec
)
/
wwo
->
waveFormat
.
Format
.
nChannels
;
}
/* Read output space info for future reference */
if
(
ioctl
(
wwo
->
ossdev
.
fd
,
SNDCTL_DSP_GETOSPACE
,
&
info
)
<
0
)
{
ERR
(
"ioctl(%s, SNDCTL_DSP_GETOSPACE) failed (%s)
\n
"
,
wwo
->
ossdev
.
dev_name
,
strerror
(
errno
));
...
...
@@ -2880,6 +2883,16 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
return
MMSYSERR_NOERROR
;
}
/* nBlockAlign and nAvgBytesPerSec are output variables for dsound */
if
(
lpDesc
->
lpFormat
->
nBlockAlign
!=
lpDesc
->
lpFormat
->
nChannels
*
lpDesc
->
lpFormat
->
wBitsPerSample
/
8
)
{
lpDesc
->
lpFormat
->
nBlockAlign
=
lpDesc
->
lpFormat
->
nChannels
*
lpDesc
->
lpFormat
->
wBitsPerSample
/
8
;
WARN
(
"Fixing nBlockAlign
\n
"
);
}
if
(
lpDesc
->
lpFormat
->
nAvgBytesPerSec
!=
lpDesc
->
lpFormat
->
nSamplesPerSec
*
lpDesc
->
lpFormat
->
nBlockAlign
)
{
lpDesc
->
lpFormat
->
nAvgBytesPerSec
=
lpDesc
->
lpFormat
->
nSamplesPerSec
*
lpDesc
->
lpFormat
->
nBlockAlign
;
WARN
(
"Fixing nAvgBytesPerSec
\n
"
);
}
TRACE
(
"OSS_OpenDevice requested this format: %dx%dx%d %s
\n
"
,
lpDesc
->
lpFormat
->
nSamplesPerSec
,
lpDesc
->
lpFormat
->
wBitsPerSample
,
...
...
@@ -2951,14 +2964,6 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
wwi
->
waveDesc
=
*
lpDesc
;
copy_format
(
lpDesc
->
lpFormat
,
&
wwi
->
waveFormat
);
if
(
wwi
->
waveFormat
.
Format
.
wBitsPerSample
==
0
)
{
WARN
(
"Resetting zeroed wBitsPerSample
\n
"
);
wwi
->
waveFormat
.
Format
.
wBitsPerSample
=
8
*
(
wwi
->
waveFormat
.
Format
.
nAvgBytesPerSec
/
wwi
->
waveFormat
.
Format
.
nSamplesPerSec
)
/
wwi
->
waveFormat
.
Format
.
nChannels
;
}
if
(
ioctl
(
wwi
->
ossdev
.
fd
,
SNDCTL_DSP_GETISPACE
,
&
info
)
<
0
)
{
ERR
(
"ioctl(%s, SNDCTL_DSP_GETISPACE) failed (%s)
\n
"
,
wwi
->
ossdev
.
dev_name
,
strerror
(
errno
));
...
...
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