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
681d5446
Commit
681d5446
authored
Oct 03, 2010
by
Nick Bowler
Committed by
Alexandre Julliard
Oct 04, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Restore old format on SetFormat failure.
parent
dfaabee3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
primary.c
dlls/dsound/primary.c
+15
-5
No files found.
dlls/dsound/primary.c
View file @
681d5446
...
...
@@ -441,10 +441,17 @@ HRESULT DSOUND_PrimaryGetPosition(DirectSoundDevice *device, LPDWORD playpos, LP
return
DS_OK
;
}
static
DWORD
DSOUND_GetFormatSize
(
LPCWAVEFORMATEX
wfex
)
{
if
(
wfex
->
wFormatTag
==
WAVE_FORMAT_PCM
)
return
sizeof
(
WAVEFORMATEX
);
else
return
sizeof
(
WAVEFORMATEX
)
+
wfex
->
cbSize
;
}
LPWAVEFORMATEX
DSOUND_CopyFormat
(
LPCWAVEFORMATEX
wfex
)
{
DWORD
size
=
wfex
->
wFormatTag
==
WAVE_FORMAT_PCM
?
sizeof
(
WAVEFORMATEX
)
:
sizeof
(
WAVEFORMATEX
)
+
wfex
->
cbSize
;
DWORD
size
=
DSOUND_GetFormatSize
(
wfex
);
LPWAVEFORMATEX
pwfx
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
pwfx
==
NULL
)
{
WARN
(
"out of memory
\n
"
);
...
...
@@ -501,11 +508,10 @@ static HRESULT DSOUND_PrimarySetFormat(DirectSoundDevice *device, LPCWAVEFORMATE
device
->
pwfx
=
DSOUND_CopyFormat
(
wfex
);
if
(
device
->
pwfx
==
NULL
)
{
device
->
pwfx
=
oldpwfx
;
oldpwfx
=
NULL
;
err
=
DSERR_OUTOFMEMORY
;
goto
done
;
}
/* TODO: on failure below (bad format?), reinstall oldpwfx */
HeapFree
(
GetProcessHeap
(),
0
,
oldpwfx
);
if
(
!
(
device
->
drvdesc
.
dwFlags
&
DSDDESC_DOMMSYSTEMSETFORMAT
)
&&
device
->
hwbuf
)
{
err
=
IDsDriverBuffer_SetFormat
(
device
->
hwbuf
,
device
->
pwfx
);
...
...
@@ -520,9 +526,12 @@ static HRESULT DSOUND_PrimarySetFormat(DirectSoundDevice *device, LPCWAVEFORMATE
}
if
(
err
!=
DSERR_BUFFERLOST
&&
FAILED
(
err
))
{
DWORD
size
=
DSOUND_GetFormatSize
(
oldpwfx
);
WARN
(
"IDsDriverBuffer_SetFormat failed
\n
"
);
if
(
!
forced
)
if
(
!
forced
)
{
CopyMemory
(
device
->
pwfx
,
oldpwfx
,
size
);
err
=
DS_OK
;
}
goto
done
;
}
...
...
@@ -599,6 +608,7 @@ done:
RtlReleaseResource
(
&
(
device
->
buffer_list_lock
));
/* **** */
HeapFree
(
GetProcessHeap
(),
0
,
oldpwfx
);
return
err
;
}
...
...
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