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

Side by Side Diff: media/audio/audio_output_proxy.h

Issue 9255017: Add thread safety to AudioManagerBase to protect access to the audio thread member variable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix linux issues. Created 8 years, 11 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
« no previous file with comments | « media/audio/audio_output_dispatcher.cc ('k') | media/audio/audio_output_proxy.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_AUDIO_OUTPUT_PROXY_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_PROXY_H_
6 #define MEDIA_AUDIO_AUDIO_OUTPUT_PROXY_H_ 6 #define MEDIA_AUDIO_AUDIO_OUTPUT_PROXY_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/threading/non_thread_safe.h"
11 #include "media/audio/audio_io.h" 12 #include "media/audio/audio_io.h"
12 #include "media/audio/audio_parameters.h" 13 #include "media/audio/audio_parameters.h"
13 14
14 class AudioOutputDispatcher; 15 class AudioOutputDispatcher;
15 16
16 // AudioOutputProxy is an audio otput stream that uses resources more 17 // AudioOutputProxy is an audio otput stream that uses resources more
17 // efficiently than a regular audio output stream: it opens audio 18 // efficiently than a regular audio output stream: it opens audio
18 // device only when sound is playing, i.e. between Start() and Stop() 19 // device only when sound is playing, i.e. between Start() and Stop()
19 // (there is still one physical stream per each audio output proxy in 20 // (there is still one physical stream per each audio output proxy in
20 // playing state). 21 // playing state).
21 // 22 //
22 // AudioOutputProxy uses AudioOutputDispatcher to open and close 23 // AudioOutputProxy uses AudioOutputDispatcher to open and close
23 // physical output streams. 24 // physical output streams.
24 class MEDIA_EXPORT AudioOutputProxy : public AudioOutputStream { 25 class MEDIA_EXPORT AudioOutputProxy :
scherkus (not reviewing) 2012/01/19 01:39:59 nit: initializer list format class Foo : publ
26 public AudioOutputStream,
27 public NON_EXPORTED_BASE(base::NonThreadSafe) {
25 public: 28 public:
26 // Caller keeps ownership of |dispatcher|. 29 // Caller keeps ownership of |dispatcher|.
27 explicit AudioOutputProxy(AudioOutputDispatcher* dispatcher); 30 explicit AudioOutputProxy(AudioOutputDispatcher* dispatcher);
28 31
29 // AudioOutputStream interface. 32 // AudioOutputStream interface.
30 virtual bool Open() OVERRIDE; 33 virtual bool Open() OVERRIDE;
31 virtual void Start(AudioSourceCallback* callback) OVERRIDE; 34 virtual void Start(AudioSourceCallback* callback) OVERRIDE;
32 virtual void Stop() OVERRIDE; 35 virtual void Stop() OVERRIDE;
33 virtual void SetVolume(double volume) OVERRIDE; 36 virtual void SetVolume(double volume) OVERRIDE;
34 virtual void GetVolume(double* volume) OVERRIDE; 37 virtual void GetVolume(double* volume) OVERRIDE;
(...skipping 18 matching lines...) Expand all
53 AudioOutputStream* physical_stream_; 56 AudioOutputStream* physical_stream_;
54 57
55 // Need to save volume here, so that we can restore it in case the stream 58 // Need to save volume here, so that we can restore it in case the stream
56 // is stopped, and then started again. 59 // is stopped, and then started again.
57 double volume_; 60 double volume_;
58 61
59 DISALLOW_COPY_AND_ASSIGN(AudioOutputProxy); 62 DISALLOW_COPY_AND_ASSIGN(AudioOutputProxy);
60 }; 63 };
61 64
62 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_PROXY_H_ 65 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_PROXY_H_
OLDNEW
« no previous file with comments | « media/audio/audio_output_dispatcher.cc ('k') | media/audio/audio_output_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698