Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ | |
| 6 #define MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/ref_counted.h" | |
| 12 #include "base/time.h" | |
| 13 #include "media/audio/audio_manager.h" | |
| 14 #include "media/audio/audio_parameters.h" | |
| 15 | |
| 16 class AudioOutputStream; | |
| 17 class MessageLoop; | |
| 18 | |
| 19 // AudioOutputDispatcher dispatches creation and deletion of audio | |
| 20 // output streams. AudioManagerBase creates one AudioOutputDispatcher | |
| 21 // per each possible set of audio parameters. AudioOutputProxy | |
| 22 // objects use this class to allocate and recycle actual audio output | |
| 23 // streams. | |
| 24 class AudioOutputDispatcher | |
| 25 : public base::RefCountedThreadSafe<AudioOutputDispatcher> { | |
| 26 public: | |
| 27 AudioOutputDispatcher(AudioManager* audio_manager, | |
| 28 const AudioParameters& params); | |
| 29 ~AudioOutputDispatcher(); | |
|
scherkus (not reviewing)
2010/11/22 06:43:15
virtual
Sergey Ulanov
2010/11/23 19:51:46
Nobody inherits from this class, and there are no
| |
| 30 | |
| 31 // Following 4 methods are called by AudioOutput when a stream | |
|
scherkus (not reviewing)
2010/11/22 06:43:15
Might be wrong here.. but do you meant AudioOutput
Sergey Ulanov
2010/11/23 19:51:46
Done.
| |
| 32 // is opened, started, stopped or closed. | |
| 33 bool StreamOpened(); | |
| 34 AudioOutputStream* StreamStarted(); | |
| 35 void StreamStopped(AudioOutputStream* stream); | |
|
scherkus (not reviewing)
2010/11/22 06:43:15
I think we need some comments for these functions
Sergey Ulanov
2010/11/23 19:51:46
Done.
| |
| 36 void StreamClosed(); | |
| 37 | |
| 38 MessageLoop* message_loop(); | |
| 39 | |
| 40 void set_close_delay(base::TimeDelta delay); | |
|
scherkus (not reviewing)
2010/11/22 06:43:15
is this only used for tests?
consider using FRIEN
Sergey Ulanov
2010/11/23 19:51:46
Yes.
| |
| 41 | |
| 42 private: | |
| 43 friend class AudioOutputProxyTest; | |
| 44 | |
| 45 AudioOutputStream* CreateAndOpenStream(); | |
| 46 void ScheduleCloseTask(); | |
| 47 void OpenTask(); | |
| 48 void CloseTask(); | |
| 49 void ClosePendingStreams(); | |
| 50 | |
| 51 AudioManager* audio_manager_; | |
| 52 MessageLoop* message_loop_; | |
| 53 AudioParameters params_; | |
| 54 base::TimeDelta close_delay_; | |
| 55 | |
| 56 int paused_proxies_; | |
| 57 std::vector<AudioOutputStream*> streams_; | |
| 58 base::Time last_activity_time_; | |
|
scherkus (not reviewing)
2010/11/22 06:43:15
I think you can replace a bunch of this last_activ
Sergey Ulanov
2010/11/23 19:51:46
Wow, that is fantastic. I didn't know about it. Ye
| |
| 59 bool close_task_scheduled_; | |
| 60 | |
| 61 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher); | |
| 62 }; | |
| 63 | |
| 64 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ | |
| OLD | NEW |