summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorenal@chromium.org <enal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-12 20:58:28 +0000
committerenal@chromium.org <enal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-12 20:58:28 +0000
commitb679b139257cf355e6de7b9ed3321426da2f4dea (patch)
tree61e83d6e4e12a0149531f1cd69f1d98dc0060a71 /media
parentac0fdb30ccff125add97db11b0d83f07713d5e0b (diff)
downloadchromium_src-b679b139257cf355e6de7b9ed3321426da2f4dea.zip
chromium_src-b679b139257cf355e6de7b9ed3321426da2f4dea.tar.gz
chromium_src-b679b139257cf355e6de7b9ed3321426da2f4dea.tar.bz2
Revert 117268 - Add CHECKs to find root cause of Windows-only crash.
Checks are temporary and would be in canary only. For gory details please see original bug 108685. BUG=109757 Review URL: http://codereview.chromium.org/9147039 TBR=enal@chromium.org Review URL: http://codereview.chromium.org/9139072 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117497 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/audio/win/waveout_output_win.cc33
-rw-r--r--media/audio/win/waveout_output_win.h5
2 files changed, 8 insertions, 30 deletions
diff --git a/media/audio/win/waveout_output_win.cc b/media/audio/win/waveout_output_win.cc
index 14605e9..148983e 100644
--- a/media/audio/win/waveout_output_win.cc
+++ b/media/audio/win/waveout_output_win.cc
@@ -87,8 +87,7 @@ PCMWaveOutAudioOutputStream::PCMWaveOutAudioOutputStream(
buffer_size_(params.GetPacketSize()),
volume_(1),
channels_(params.channels),
- pending_bytes_(0),
- thread_id_(GetCurrentThreadId()) {
+ pending_bytes_(0) {
format_.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
format_.Format.nChannels = params.channels;
format_.Format.nSamplesPerSec = params.sample_rate;
@@ -113,7 +112,6 @@ PCMWaveOutAudioOutputStream::~PCMWaveOutAudioOutputStream() {
}
bool PCMWaveOutAudioOutputStream::Open() {
- CHECK_EQ(thread_id_, GetCurrentThreadId());
if (state_ != PCMA_BRAND_NEW)
return false;
if (BufferSize() * num_buffers_ > kMaxOpenBufferSize)
@@ -147,7 +145,6 @@ bool PCMWaveOutAudioOutputStream::Open() {
}
void PCMWaveOutAudioOutputStream::SetupBuffers() {
- CHECK_EQ(thread_id_, GetCurrentThreadId());
buffers_.reset(new char[BufferSize() * num_buffers_]);
for (int ix = 0; ix != num_buffers_; ++ix) {
WAVEHDR* buffer = GetBuffer(ix);
@@ -164,7 +161,6 @@ void PCMWaveOutAudioOutputStream::SetupBuffers() {
}
void PCMWaveOutAudioOutputStream::FreeBuffers() {
- CHECK_EQ(thread_id_, GetCurrentThreadId());
for (int ix = 0; ix != num_buffers_; ++ix) {
::waveOutUnprepareHeader(waveout_, GetBuffer(ix), sizeof(WAVEHDR));
}
@@ -175,7 +171,6 @@ void PCMWaveOutAudioOutputStream::FreeBuffers() {
// this then we would always get the driver callback when it is about to run
// samples and that would leave too little time to react.
void PCMWaveOutAudioOutputStream::Start(AudioSourceCallback* callback) {
- CHECK_EQ(thread_id_, GetCurrentThreadId());
if (state_ != PCMA_READY)
return;
callback_ = callback;
@@ -190,8 +185,6 @@ void PCMWaveOutAudioOutputStream::Start(AudioSourceCallback* callback) {
INFINITE,
WT_EXECUTEDEFAULT);
if (!waiting_handle) {
- volatile DWORD code = GetLastError();
- CHECK(false);
HandleError(MMSYSERR_ERROR);
return;
}
@@ -219,7 +212,6 @@ void PCMWaveOutAudioOutputStream::Start(AudioSourceCallback* callback) {
MMRESULT result = ::waveOutPause(waveout_);
if (result != MMSYSERR_NOERROR) {
- CHECK(false);
HandleError(result);
return;
}
@@ -229,14 +221,12 @@ void PCMWaveOutAudioOutputStream::Start(AudioSourceCallback* callback) {
for (int ix = 0; ix != num_buffers_; ++ix) {
result = ::waveOutWrite(waveout_, GetBuffer(ix), sizeof(WAVEHDR));
if (result != MMSYSERR_NOERROR) {
- CHECK(false);
HandleError(result);
break;
}
}
result = ::waveOutRestart(waveout_);
if (result != MMSYSERR_NOERROR) {
- CHECK(false);
HandleError(result);
return;
}
@@ -250,7 +240,6 @@ void PCMWaveOutAudioOutputStream::Start(AudioSourceCallback* callback) {
// should be under its own lock, and checking the liveness and
// acquiring the lock on stream should be done atomically.
void PCMWaveOutAudioOutputStream::Stop() {
- CHECK_EQ(thread_id_, GetCurrentThreadId());
if (state_ != PCMA_PLAYING)
return;
state_ = PCMA_STOPPING;
@@ -259,7 +248,6 @@ void PCMWaveOutAudioOutputStream::Stop() {
// Stop playback.
MMRESULT res = ::waveOutReset(waveout_);
if (res != MMSYSERR_NOERROR) {
- CHECK(false);
state_ = PCMA_PLAYING;
HandleError(res);
return;
@@ -279,8 +267,6 @@ void PCMWaveOutAudioOutputStream::Stop() {
if (waiting_handle) {
BOOL unregister = UnregisterWaitEx(waiting_handle, INVALID_HANDLE_VALUE);
if (!unregister) {
- volatile DWORD code = GetLastError();
- CHECK(false);
state_ = PCMA_PLAYING;
HandleError(MMSYSERR_ERROR);
}
@@ -297,17 +283,15 @@ void PCMWaveOutAudioOutputStream::Stop() {
// as callback_ is set to NULL. Just print it and hope somebody somehow
// will find it...
void PCMWaveOutAudioOutputStream::Close() {
- CHECK_EQ(thread_id_, GetCurrentThreadId());
Stop(); // Just to be sure. No-op if not playing.
if (waveout_) {
MMRESULT res = ::waveOutClose(waveout_);
- if (res != MMSYSERR_NOERROR) {
- CHECK(false);
- HandleError(res);
- }
- // 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().
+ // 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();
@@ -319,21 +303,18 @@ void PCMWaveOutAudioOutputStream::Close() {
}
void PCMWaveOutAudioOutputStream::SetVolume(double volume) {
- CHECK_EQ(thread_id_, GetCurrentThreadId());
if (!waveout_)
return;
volume_ = static_cast<float>(volume);
}
void PCMWaveOutAudioOutputStream::GetVolume(double* volume) {
- CHECK_EQ(thread_id_, GetCurrentThreadId());
if (!waveout_)
return;
*volume = volume_;
}
void PCMWaveOutAudioOutputStream::HandleError(MMRESULT error) {
- CHECK_EQ(thread_id_, GetCurrentThreadId());
DLOG(WARNING) << "PCMWaveOutAudio error " << error;
if (callback_)
callback_->OnError(this, error);
diff --git a/media/audio/win/waveout_output_win.h b/media/audio/win/waveout_output_win.h
index 03e019c..e7cb4ed 100644
--- a/media/audio/win/waveout_output_win.h
+++ b/media/audio/win/waveout_output_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -129,9 +129,6 @@ class PCMWaveOutAudioOutputStream : public AudioOutputStream {
// Lock used to avoid the conflict when callbacks are called simultaneously.
base::Lock lock_;
- // Temporary here, for CHECK().
- DWORD thread_id_;
-
DISALLOW_COPY_AND_ASSIGN(PCMWaveOutAudioOutputStream);
};