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

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

Issue 2621993002: Makes AudioOutputProxy -> AudioOutputDispatcher reference weak. (Closed)
Patch Set: adds CreateStreamProxy Created 3 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
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 // AudioOutputDispatcher is a single-threaded base class that dispatches 5 // AudioOutputDispatcher is a single-threaded base class that dispatches
6 // creation and deletion of audio output streams. AudioOutputProxy objects use 6 // creation and deletion of audio output streams. AudioOutputProxy objects use
7 // this class to allocate and recycle actual audio output streams. When playback 7 // this class to allocate and recycle actual audio output streams. When playback
8 // is started, the proxy calls StartStream() to get an output stream that it 8 // is started, the proxy calls StartStream() to get an output stream that it
9 // uses to play audio. When playback is stopped, the proxy returns the stream 9 // uses to play audio. When playback is stopped, the proxy returns the stream
10 // back to the dispatcher by calling StopStream(). 10 // back to the dispatcher by calling StopStream().
(...skipping 20 matching lines...) Expand all
31 31
32 class AudioOutputProxy; 32 class AudioOutputProxy;
33 33
34 class MEDIA_EXPORT AudioOutputDispatcher { 34 class MEDIA_EXPORT AudioOutputDispatcher {
35 public: 35 public:
36 AudioOutputDispatcher(AudioManager* audio_manager, 36 AudioOutputDispatcher(AudioManager* audio_manager,
37 const AudioParameters& params, 37 const AudioParameters& params,
38 const std::string& device_id); 38 const std::string& device_id);
39 virtual ~AudioOutputDispatcher(); 39 virtual ~AudioOutputDispatcher();
40 40
41 // Creates an instance of AudioOutputProxy, which uses |this| as dispatcher.
42 // The client owns the returned pointer, which can be deleted using
43 // AudioOutputProxy::Close.
44 virtual AudioOutputProxy* CreateStreamProxy() = 0;
45
41 // Called by AudioOutputProxy to open the stream. 46 // Called by AudioOutputProxy to open the stream.
42 // Returns false, if it fails to open it. 47 // Returns false, if it fails to open it.
43 virtual bool OpenStream() = 0; 48 virtual bool OpenStream() = 0;
44 49
45 // Called by AudioOutputProxy when the stream is started. 50 // Called by AudioOutputProxy when the stream is started.
46 // Uses |callback| to get source data and report errors, if any. 51 // Uses |callback| to get source data and report errors, if any.
47 // Does *not* take ownership of this callback. 52 // Does *not* take ownership of this callback.
48 // Returns true if started successfully, false otherwise. 53 // Returns true if started successfully, false otherwise.
49 virtual bool StartStream(AudioOutputStream::AudioSourceCallback* callback, 54 virtual bool StartStream(AudioOutputStream::AudioSourceCallback* callback,
50 AudioOutputProxy* stream_proxy) = 0; 55 AudioOutputProxy* stream_proxy) = 0;
(...skipping 19 matching lines...) Expand all
70 const AudioParameters params_; 75 const AudioParameters params_;
71 std::string device_id_; 76 std::string device_id_;
72 77
73 private: 78 private:
74 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher); 79 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher);
75 }; 80 };
76 81
77 } // namespace media 82 } // namespace media
78 83
79 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ 84 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698