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

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

Issue 10958020: Don't fallback if we've successfully opened a stream previously. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments w/o state machine. Created 8 years, 3 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 | Annotate | Revision Log
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 // 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 22 matching lines...) Expand all
33 33
34 class MEDIA_EXPORT AudioOutputDispatcherImpl : public AudioOutputDispatcher { 34 class MEDIA_EXPORT AudioOutputDispatcherImpl : public AudioOutputDispatcher {
35 public: 35 public:
36 // |close_delay_ms| specifies delay after the stream is paused until 36 // |close_delay_ms| specifies delay after the stream is paused until
37 // the audio device is closed. 37 // the audio device is closed.
38 AudioOutputDispatcherImpl(AudioManager* audio_manager, 38 AudioOutputDispatcherImpl(AudioManager* audio_manager,
39 const AudioParameters& params, 39 const AudioParameters& params,
40 const base::TimeDelta& close_delay); 40 const base::TimeDelta& close_delay);
41 41
42 // Opens a new physical stream if there are no pending streams in 42 // Opens a new physical stream if there are no pending streams in
43 // |idle_streams_|. 43 // |idle_streams_|. Do not call Close() or Stop() if this method fails.
44 virtual bool OpenStream() OVERRIDE; 44 virtual bool OpenStream() OVERRIDE;
45 45
46 // If there are pending streams in |idle_streams_| then it reuses one of 46 // If there are pending streams in |idle_streams_| then it reuses one of
47 // them, otherwise creates a new one. 47 // them, otherwise creates a new one.
48 virtual bool StartStream(AudioOutputStream::AudioSourceCallback* callback, 48 virtual bool StartStream(AudioOutputStream::AudioSourceCallback* callback,
49 AudioOutputProxy* stream_proxy) OVERRIDE; 49 AudioOutputProxy* stream_proxy) OVERRIDE;
50 50
51 // Holds the physical stream temporarily in |pausing_streams_| and then 51 // Holds the physical stream temporarily in |pausing_streams_| and then
52 // |stream| is added to the pool of pending streams (i.e. |idle_streams_|). 52 // |stream| is added to the pool of pending streams (i.e. |idle_streams_|).
53 virtual void StopStream(AudioOutputProxy* stream_proxy) OVERRIDE; 53 virtual void StopStream(AudioOutputProxy* stream_proxy) OVERRIDE;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 base::DelayTimer<AudioOutputDispatcherImpl> close_timer_; 93 base::DelayTimer<AudioOutputDispatcherImpl> close_timer_;
94 94
95 AudioStreamMap proxy_to_physical_map_; 95 AudioStreamMap proxy_to_physical_map_;
96 96
97 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcherImpl); 97 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcherImpl);
98 }; 98 };
99 99
100 } // namespace media 100 } // namespace media
101 101
102 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_IMPL_H_ 102 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | media/audio/audio_output_dispatcher_impl.cc » ('j') | media/audio/audio_output_dispatcher_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698