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

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

Issue 5158003: Implement AudioOutputProxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 10 years, 1 month 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
OLDNEW
(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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698