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

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

Issue 160497: Reimplement the AlsaPcmOutputStream and fix the threading issues. (Closed)
Patch Set: Address Andrew's comments. Diff aginst Patch 8 please. Created 11 years, 4 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
« no previous file with comments | « media/audio/linux/alsa_wrapper.cc ('k') | media/audio/linux/audio_manager_linux.cc » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #ifndef MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_ 5 #ifndef MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_
6 #define MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_ 6 #define MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_
7 7
8 #include <map>
9
10 #include "base/ref_counted.h"
11 #include "base/scoped_ptr.h"
8 #include "base/thread.h" 12 #include "base/thread.h"
9 #include "media/audio/audio_output.h" 13 #include "media/audio/audio_output.h"
10 14
15 class AlsaPcmOutputStream;
16 class AlsaWrapper;
17
11 class AudioManagerLinux : public AudioManager { 18 class AudioManagerLinux : public AudioManager {
12 public: 19 public:
13 AudioManagerLinux(); 20 AudioManagerLinux();
14 21
22 // Call before using a newly created AudioManagerLinux instance.
23 void Init();
24
15 // Implementation of AudioManager. 25 // Implementation of AudioManager.
16 virtual bool HasAudioDevices(); 26 virtual bool HasAudioDevices();
17 virtual AudioOutputStream* MakeAudioStream(Format format, int channels, 27 virtual AudioOutputStream* MakeAudioStream(Format format, int channels,
18 int sample_rate, 28 int sample_rate,
19 char bits_per_sample); 29 char bits_per_sample);
20 virtual void MuteAll(); 30 virtual void MuteAll();
21 virtual void UnMuteAll(); 31 virtual void UnMuteAll();
22 32
23 private: 33 private:
24 // Friend function for invoking the private destructor at exit. 34 // Friend function for invoking the private destructor at exit.
25 friend void DestroyAudioManagerLinux(void*); 35 friend void DestroyAudioManagerLinux(void*);
26 virtual ~AudioManagerLinux(); 36 virtual ~AudioManagerLinux();
27 37
38 // Thread used to interact with AudioOutputStreams created by this
39 // audio manger.
40 base::Thread audio_thread_;
41 scoped_ptr<AlsaWrapper> wrapper_;
42
43 std::map<AlsaPcmOutputStream*, scoped_refptr<AlsaPcmOutputStream> >
44 active_streams_;
45
46 bool initialized_;
47
28 DISALLOW_COPY_AND_ASSIGN(AudioManagerLinux); 48 DISALLOW_COPY_AND_ASSIGN(AudioManagerLinux);
29 }; 49 };
30 50
31 #endif // MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_ 51 #endif // MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_
OLDNEW
« no previous file with comments | « media/audio/linux/alsa_wrapper.cc ('k') | media/audio/linux/audio_manager_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698