summaryrefslogtreecommitdiffstats
path: root/media/audio/win
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-11 11:34:53 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-11 11:34:53 +0000
commit6b0868b3a91974f8015b48f4bcc8fcd8228ff5a0 (patch)
treeaafdd88a4c31d047a7789ab3049efefc1bc2da6c /media/audio/win
parentbcd1df77729e966a225de98957dbaf0c687a89d0 (diff)
downloadchromium_src-6b0868b3a91974f8015b48f4bcc8fcd8228ff5a0.zip
chromium_src-6b0868b3a91974f8015b48f4bcc8fcd8228ff5a0.tar.gz
chromium_src-6b0868b3a91974f8015b48f4bcc8fcd8228ff5a0.tar.bz2
Fix "waveOutClose failure causes PCMWaveOutAudioOutputStream to never get deleted"
Always transfer to the 'closed' state and call ReleaseOutputStream when Close() is called. * If waveOutClose failed, then the PCMWaveOutAudioOutputStream object will go into a bad state and never get deleted. * I'm removing the call to HandleError() since callback_ will always be NULL. This is possibly related to bug 108685. TEST=Fixes possible starvation of output streams and object leaks (see above). BUG=109837 Review URL: http://codereview.chromium.org/9158018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117203 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/win')
-rw-r--r--media/audio/win/waveout_output_win.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/media/audio/win/waveout_output_win.cc b/media/audio/win/waveout_output_win.cc
index 7aea178..148983e 100644
--- a/media/audio/win/waveout_output_win.cc
+++ b/media/audio/win/waveout_output_win.cc
@@ -286,10 +286,12 @@ void PCMWaveOutAudioOutputStream::Close() {
Stop(); // Just to be sure. No-op if not playing.
if (waveout_) {
MMRESULT res = ::waveOutClose(waveout_);
- if (res != MMSYSERR_NOERROR) {
- HandleError(res);
- return;
- }
+ // The callback was cleared by the call to Stop(), so there's no point in
+ // calling HandleError at this point. Also, even though waveOutClose might
+ // fail, we do not want to attempt to close the handle again, so we always
+ // transfer to the closed state and NULL the handle. Moreover, we must
+ // always call ReleaseOutputStream().
+ DLOG_IF(ERROR, res != MMSYSERR_NOERROR) << "waveOutClose() failed";
state_ = PCMA_CLOSED;
waveout_ = NULL;
FreeBuffers();