| Index: media/audio/audio_output_dispatcher.h
|
| diff --git a/media/audio/audio_output_dispatcher.h b/media/audio/audio_output_dispatcher.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..532791d1819d063142c59734da15534f625c6d62
|
| --- /dev/null
|
| +++ b/media/audio/audio_output_dispatcher.h
|
| @@ -0,0 +1,64 @@
|
| +// Copyright (c) 2010 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_
|
| +#define MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_
|
| +
|
| +#include <vector>
|
| +
|
| +#include "base/basictypes.h"
|
| +#include "base/ref_counted.h"
|
| +#include "base/time.h"
|
| +#include "media/audio/audio_manager.h"
|
| +#include "media/audio/audio_parameters.h"
|
| +
|
| +class AudioOutputStream;
|
| +class MessageLoop;
|
| +
|
| +// AudioOutputDispatcher dispatches creation and deletion of audio
|
| +// output streams. AudioManagerBase creates one AudioOutputDispatcher
|
| +// per each possible set of audio parameters. AudioOutputProxy
|
| +// objects use this class to allocate and recycle actual audio output
|
| +// streams.
|
| +class AudioOutputDispatcher
|
| + : public base::RefCountedThreadSafe<AudioOutputDispatcher> {
|
| + public:
|
| + AudioOutputDispatcher(AudioManager* audio_manager,
|
| + const AudioParameters& params);
|
| + ~AudioOutputDispatcher();
|
| +
|
| + // Following 4 methods are called by AudioOutput when a stream
|
| + // is opened, started, stopped or closed.
|
| + bool StreamOpened();
|
| + AudioOutputStream* StreamStarted();
|
| + void StreamStopped(AudioOutputStream* stream);
|
| + void StreamClosed();
|
| +
|
| + MessageLoop* message_loop();
|
| +
|
| + void set_close_delay(base::TimeDelta delay);
|
| +
|
| + private:
|
| + friend class AudioOutputProxyTest;
|
| +
|
| + AudioOutputStream* CreateAndOpenStream();
|
| + void ScheduleCloseTask();
|
| + void OpenTask();
|
| + void CloseTask();
|
| + void ClosePendingStreams();
|
| +
|
| + AudioManager* audio_manager_;
|
| + MessageLoop* message_loop_;
|
| + AudioParameters params_;
|
| + base::TimeDelta close_delay_;
|
| +
|
| + int paused_proxies_;
|
| + std::vector<AudioOutputStream*> streams_;
|
| + base::Time last_activity_time_;
|
| + bool close_task_scheduled_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher);
|
| +};
|
| +
|
| +#endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_
|
|
|