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

Side by Side Diff: media/audio/linux/audio_manager_linux.cc

Issue 5158003: Implement AudioOutputProxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed memleak in the unittests Created 10 years 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
« no previous file with comments | « media/audio/audio_parameters_unittest.cc ('k') | media/media.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/linux/audio_manager_linux.h" 5 #include "media/audio/linux/audio_manager_linux.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "media/audio/audio_output_dispatcher.h"
9 #include "media/audio/fake_audio_input_stream.h" 10 #include "media/audio/fake_audio_input_stream.h"
10 #include "media/audio/fake_audio_output_stream.h" 11 #include "media/audio/fake_audio_output_stream.h"
11 #include "media/audio/linux/alsa_input.h" 12 #include "media/audio/linux/alsa_input.h"
12 #include "media/audio/linux/alsa_output.h" 13 #include "media/audio/linux/alsa_output.h"
13 #include "media/audio/linux/alsa_wrapper.h" 14 #include "media/audio/linux/alsa_wrapper.h"
14 #include "media/base/limits.h" 15 #include "media/base/limits.h"
15 #include "media/base/media_switches.h" 16 #include "media/base/media_switches.h"
16 17
17 namespace { 18 namespace {
18 19
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 AudioManagerLinux::AudioManagerLinux() { 88 AudioManagerLinux::AudioManagerLinux() {
88 } 89 }
89 90
90 AudioManagerLinux::~AudioManagerLinux() { 91 AudioManagerLinux::~AudioManagerLinux() {
91 // Make sure we stop the thread first. If we let the default destructor to 92 // Make sure we stop the thread first. If we let the default destructor to
92 // destruct the members, we may destroy audio streams before stopping the 93 // destruct the members, we may destroy audio streams before stopping the
93 // thread, resulting an unexpected behavior. 94 // thread, resulting an unexpected behavior.
94 // This way we make sure activities of the audio streams are all stopped 95 // This way we make sure activities of the audio streams are all stopped
95 // before we destroy them. 96 // before we destroy them.
96 audio_thread_.Stop(); 97 audio_thread_.Stop();
98
99 // Free output dispatchers, closing all remaining open streams.
100 output_dispatchers_.clear();
101
97 active_streams_.clear(); 102 active_streams_.clear();
98 } 103 }
99 104
100 void AudioManagerLinux::Init() { 105 void AudioManagerLinux::Init() {
101 AudioManagerBase::Init(); 106 AudioManagerBase::Init();
102 wrapper_.reset(new AlsaWrapper()); 107 wrapper_.reset(new AlsaWrapper());
103 } 108 }
104 109
105 void AudioManagerLinux::MuteAll() { 110 void AudioManagerLinux::MuteAll() {
106 NOTIMPLEMENTED(); 111 NOTIMPLEMENTED();
107 } 112 }
108 113
109 void AudioManagerLinux::UnMuteAll() { 114 void AudioManagerLinux::UnMuteAll() {
110 NOTIMPLEMENTED(); 115 NOTIMPLEMENTED();
111 } 116 }
112 117
113 void AudioManagerLinux::ReleaseOutputStream(AlsaPcmOutputStream* stream) { 118 void AudioManagerLinux::ReleaseOutputStream(AlsaPcmOutputStream* stream) {
114 if (stream) { 119 if (stream) {
115 AutoLock l(lock_); 120 AutoLock l(lock_);
116 active_streams_.erase(stream); 121 active_streams_.erase(stream);
117 } 122 }
118 } 123 }
119 124
120 // static 125 // static
121 AudioManager* AudioManager::CreateAudioManager() { 126 AudioManager* AudioManager::CreateAudioManager() {
122 return new AudioManagerLinux(); 127 return new AudioManagerLinux();
123 } 128 }
OLDNEW
« no previous file with comments | « media/audio/audio_parameters_unittest.cc ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698