| OLD | NEW |
| 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 // AudioOutputDispatcherImpl is an implementation of AudioOutputDispatcher. | 5 // AudioOutputDispatcherImpl is an implementation of AudioOutputDispatcher. |
| 6 // | 6 // |
| 7 // To avoid opening and closing audio devices more frequently than necessary, | 7 // To avoid opening and closing audio devices more frequently than necessary, |
| 8 // each dispatcher has a pool of inactive physical streams. A stream is closed | 8 // each dispatcher has a pool of inactive physical streams. A stream is closed |
| 9 // only if it hasn't been used for a certain period of time (specified via the | 9 // only if it hasn't been used for a certain period of time (specified via the |
| 10 // constructor). | 10 // constructor). |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 namespace media { | 28 namespace media { |
| 29 | 29 |
| 30 class AudioOutputProxy; | 30 class AudioOutputProxy; |
| 31 | 31 |
| 32 class MEDIA_EXPORT AudioOutputDispatcherImpl : public AudioOutputDispatcher { | 32 class MEDIA_EXPORT AudioOutputDispatcherImpl : public AudioOutputDispatcher { |
| 33 public: | 33 public: |
| 34 // |close_delay_ms| specifies delay after the stream is paused until | 34 // |close_delay_ms| specifies delay after the stream is paused until |
| 35 // the audio device is closed. | 35 // the audio device is closed. |
| 36 AudioOutputDispatcherImpl(AudioManager* audio_manager, | 36 AudioOutputDispatcherImpl(AudioManager* audio_manager, |
| 37 const AudioParameters& params, | 37 const AudioParameters& params, |
| 38 const std::string& input_device_id, |
| 38 const base::TimeDelta& close_delay); | 39 const base::TimeDelta& close_delay); |
| 39 | 40 |
| 40 // Opens a new physical stream if there are no pending streams in | 41 // Opens a new physical stream if there are no pending streams in |
| 41 // |idle_streams_|. Do not call Close() or Stop() if this method fails. | 42 // |idle_streams_|. Do not call Close() or Stop() if this method fails. |
| 42 virtual bool OpenStream() OVERRIDE; | 43 virtual bool OpenStream() OVERRIDE; |
| 43 | 44 |
| 44 // If there are pending streams in |idle_streams_| then it reuses one of | 45 // If there are pending streams in |idle_streams_| then it reuses one of |
| 45 // them, otherwise creates a new one. | 46 // them, otherwise creates a new one. |
| 46 virtual bool StartStream(AudioOutputStream::AudioSourceCallback* callback, | 47 virtual bool StartStream(AudioOutputStream::AudioSourceCallback* callback, |
| 47 AudioOutputProxy* stream_proxy) OVERRIDE; | 48 AudioOutputProxy* stream_proxy) OVERRIDE; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 base::DelayTimer<AudioOutputDispatcherImpl> close_timer_; | 92 base::DelayTimer<AudioOutputDispatcherImpl> close_timer_; |
| 92 | 93 |
| 93 AudioStreamMap proxy_to_physical_map_; | 94 AudioStreamMap proxy_to_physical_map_; |
| 94 | 95 |
| 95 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcherImpl); | 96 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcherImpl); |
| 96 }; | 97 }; |
| 97 | 98 |
| 98 } // namespace media | 99 } // namespace media |
| 99 | 100 |
| 100 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_IMPL_H_ | 101 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_IMPL_H_ |
| OLD | NEW |