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

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

Issue 2570923002: Makes AudioOutputDispatcher non-ref-counted. (Closed)
Patch Set: Created 4 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
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 #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/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/threading/non_thread_safe.h" 10 #include "base/threading/non_thread_safe.h"
12 #include "media/audio/audio_io.h" 11 #include "media/audio/audio_io.h"
13 #include "media/base/audio_parameters.h" 12 #include "media/base/audio_parameters.h"
14 13
15 namespace media { 14 namespace media {
16 15
17 class AudioOutputDispatcher; 16 class AudioOutputDispatcher;
18 17
19 // AudioOutputProxy is an audio otput stream that uses resources more 18 // AudioOutputProxy is an audio otput stream that uses resources more
20 // efficiently than a regular audio output stream: it opens audio 19 // efficiently than a regular audio output stream: it opens audio
(...skipping 12 matching lines...) Expand all
33 32
34 // AudioOutputStream interface. 33 // AudioOutputStream interface.
35 bool Open() override; 34 bool Open() override;
36 void Start(AudioSourceCallback* callback) override; 35 void Start(AudioSourceCallback* callback) override;
37 void Stop() override; 36 void Stop() override;
38 void SetVolume(double volume) override; 37 void SetVolume(double volume) override;
39 void GetVolume(double* volume) override; 38 void GetVolume(double* volume) override;
40 void Close() override; 39 void Close() override;
41 40
42 AudioOutputDispatcher* get_dispatcher_for_testing() const { 41 AudioOutputDispatcher* get_dispatcher_for_testing() const {
43 return dispatcher_.get(); 42 return dispatcher_;
44 } 43 }
45 44
46 private: 45 private:
47 enum State { 46 enum State {
48 kCreated, 47 kCreated,
49 kOpened, 48 kOpened,
50 kPlaying, 49 kPlaying,
51 kClosed, 50 kClosed,
52 kOpenError, 51 kOpenError,
53 kStartError, 52 kStartError,
54 }; 53 };
55 54
56 ~AudioOutputProxy() override; 55 ~AudioOutputProxy() override;
57 56
58 scoped_refptr<AudioOutputDispatcher> dispatcher_; 57 AudioOutputDispatcher* dispatcher_;
59 State state_; 58 State state_;
60 59
61 // Need to save volume here, so that we can restore it in case the stream 60 // Need to save volume here, so that we can restore it in case the stream
62 // is stopped, and then started again. 61 // is stopped, and then started again.
63 double volume_; 62 double volume_;
64 63
65 DISALLOW_COPY_AND_ASSIGN(AudioOutputProxy); 64 DISALLOW_COPY_AND_ASSIGN(AudioOutputProxy);
66 }; 65 };
67 66
68 } // namespace media 67 } // namespace media
69 68
70 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_PROXY_H_ 69 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698