Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(810)

Unified Diff: media/audio/win/wavein_input_win.cc

Issue 7129057: Fix bug when unplugging an audio input device whilst using speech input. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Whitespace Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/audio/win/wavein_input_win.cc
diff --git a/media/audio/win/wavein_input_win.cc b/media/audio/win/wavein_input_win.cc
index fdc08b875d73e219b5fe3f0e189b9fda62d4182e..a3a6940b7b701be576419a9f4664215a25c039e7 100644
--- a/media/audio/win/wavein_input_win.cc
+++ b/media/audio/win/wavein_input_win.cc
@@ -14,6 +14,10 @@
#include "media/audio/audio_util.h"
#include "media/audio/win/audio_manager_win.h"
+namespace {
+const int kCallbackTimeout = 1000; // One second.
Satish 2011/06/14 14:28:04 rename to kStopInputStreamCallbackTimeout to be mo
allanwoj 2011/06/14 15:03:12 Done.
+}
+
// Our sound buffers are allocated once and kept in a linked list using the
// the WAVEHDR::dwUser variable. The last buffer points to the first buffer.
static WAVEHDR* GetNextBuffer(WAVEHDR* current) {
@@ -130,7 +134,8 @@ void PCMWaveInAudioInputStream::Stop() {
return;
state_ = kStateStopping;
// Wait for the callback to finish, it will signal us when ready to be reset.
- if (WAIT_OBJECT_0 != ::WaitForSingleObject(stopped_event_, INFINITE)) {
+ if (WAIT_OBJECT_0 !=
+ ::WaitForSingleObject(stopped_event_, kCallbackTimeout)) {
HandleError(::GetLastError());
return;
}

Powered by Google App Engine
This is Rietveld 408576698