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

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

Issue 901053010: Purge AudioOutputDispatcher after close delay if no proxies exist. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2292
Patch Set: Created 5 years, 10 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
« no previous file with comments | « media/audio/audio_output_dispatcher_impl.h ('k') | media/audio/audio_output_proxy_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "media/audio/audio_output_dispatcher_impl.h" 5 #include "media/audio/audio_output_dispatcher_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 // Close all idle streams immediately. The |close_timer_| will handle 124 // Close all idle streams immediately. The |close_timer_| will handle
125 // invalidating any outstanding tasks upon its destruction. 125 // invalidating any outstanding tasks upon its destruction.
126 CloseAllIdleStreams(); 126 CloseAllIdleStreams();
127 127
128 // No AudioOutputProxy objects should hold a reference to us when we get 128 // No AudioOutputProxy objects should hold a reference to us when we get
129 // to this stage. 129 // to this stage.
130 DCHECK(HasOneRef()) << "Only the AudioManager should hold a reference"; 130 DCHECK(HasOneRef()) << "Only the AudioManager should hold a reference";
131 } 131 }
132 132
133 bool AudioOutputDispatcherImpl::HasOutputProxies() const {
134 return idle_proxies_ || !proxy_to_physical_map_.empty();
135 }
136
133 bool AudioOutputDispatcherImpl::CreateAndOpenStream() { 137 bool AudioOutputDispatcherImpl::CreateAndOpenStream() {
134 DCHECK(task_runner_->BelongsToCurrentThread()); 138 DCHECK(task_runner_->BelongsToCurrentThread());
135 AudioOutputStream* stream = audio_manager_->MakeAudioOutputStream( 139 AudioOutputStream* stream = audio_manager_->MakeAudioOutputStream(
136 params_, device_id_); 140 params_, device_id_);
137 if (!stream) 141 if (!stream)
138 return false; 142 return false;
139 143
140 if (!stream->Open()) { 144 if (!stream->Open()) {
141 stream->Close(); 145 stream->Close();
142 return false; 146 return false;
(...skipping 23 matching lines...) Expand all
166 170
167 AudioStreamIDMap::iterator it = audio_stream_ids_.find(stream); 171 AudioStreamIDMap::iterator it = audio_stream_ids_.find(stream);
168 DCHECK(it != audio_stream_ids_.end()); 172 DCHECK(it != audio_stream_ids_.end());
169 audio_log_->OnClosed(it->second); 173 audio_log_->OnClosed(it->second);
170 audio_stream_ids_.erase(it); 174 audio_stream_ids_.erase(it);
171 } 175 }
172 idle_streams_.erase(idle_streams_.begin() + keep_alive, idle_streams_.end()); 176 idle_streams_.erase(idle_streams_.begin() + keep_alive, idle_streams_.end());
173 } 177 }
174 178
175 } // namespace media 179 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_output_dispatcher_impl.h ('k') | media/audio/audio_output_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698