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

Side by Side Diff: media/audio/openbsd/audio_manager_openbsd.cc

Issue 9692038: stopping the audio thread before destroying the AudioManager<Platform> (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased and fixed the speech recognition unittest Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/audio/openbsd/audio_manager_openbsd.h" 5 #include "media/audio/openbsd/audio_manager_openbsd.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "media/audio/audio_output_dispatcher.h" 9 #include "media/audio/audio_output_dispatcher.h"
10 #if defined(USE_PULSEAUDIO) 10 #if defined(USE_PULSEAUDIO)
(...skipping 28 matching lines...) Expand all
39 39
40 bool AudioManagerOpenBSD::HasAudioInputDevices() { 40 bool AudioManagerOpenBSD::HasAudioInputDevices() {
41 return HasAudioHardware(); 41 return HasAudioHardware();
42 } 42 }
43 43
44 AudioManagerOpenBSD::AudioManagerOpenBSD() { 44 AudioManagerOpenBSD::AudioManagerOpenBSD() {
45 SetMaxOutputStreamsAllowed(kMaxOutputStreams); 45 SetMaxOutputStreamsAllowed(kMaxOutputStreams);
46 } 46 }
47 47
48 AudioManagerOpenBSD::~AudioManagerOpenBSD() { 48 AudioManagerOpenBSD::~AudioManagerOpenBSD() {
49 // Make sure we stop the thread first. If we allow the default destructor to 49 Shutdown();
50 // destroy the members, we may destroy audio streams before stopping the
51 // thread, resulting an unexpected behavior.
52 // This way we make sure activities of the audio streams are all stopped
53 // before we destroy them.
54 audio_thread_.Stop();
55
56 // Free output dispatchers, closing all remaining open streams.
57 output_dispatchers_.clear();
58 } 50 }
59 51
60 void AudioManagerOpenBSD::Init() { 52 void AudioManagerOpenBSD::Init() {
61 AudioManagerBase::Init(); 53 AudioManagerBase::Init();
62 } 54 }
63 55
64 void AudioManagerOpenBSD::MuteAll() { 56 void AudioManagerOpenBSD::MuteAll() {
65 NOTIMPLEMENTED(); 57 NOTIMPLEMENTED();
66 } 58 }
67 59
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 #endif 100 #endif
109 101
110 NOTIMPLEMENTED(); 102 NOTIMPLEMENTED();
111 return NULL; 103 return NULL;
112 } 104 }
113 105
114 // static 106 // static
115 AudioManager* CreateAudioManager() { 107 AudioManager* CreateAudioManager() {
116 return new AudioManagerOpenBSD(); 108 return new AudioManagerOpenBSD();
117 } 109 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698