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

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

Issue 1864483002: Forward output glitch information from stream WebRTC log (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 6 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_manager_base.cc ('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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 << "Active proxy streams during shutdown: " 139 << "Active proxy streams during shutdown: "
140 << proxy_to_physical_map_.size(); 140 << proxy_to_physical_map_.size();
141 } 141 }
142 142
143 bool AudioOutputDispatcherImpl::HasOutputProxies() const { 143 bool AudioOutputDispatcherImpl::HasOutputProxies() const {
144 return idle_proxies_ || !proxy_to_physical_map_.empty(); 144 return idle_proxies_ || !proxy_to_physical_map_.empty();
145 } 145 }
146 146
147 bool AudioOutputDispatcherImpl::CreateAndOpenStream() { 147 bool AudioOutputDispatcherImpl::CreateAndOpenStream() {
148 DCHECK(task_runner_->BelongsToCurrentThread()); 148 DCHECK(task_runner_->BelongsToCurrentThread());
149
150 const int stream_id = audio_stream_id_++;
149 AudioOutputStream* stream = audio_manager_->MakeAudioOutputStream( 151 AudioOutputStream* stream = audio_manager_->MakeAudioOutputStream(
150 params_, device_id_); 152 params_, device_id_,
153 base::Bind(&AudioLog::OnLogMessage, base::Unretained(audio_log_.get()),
154 stream_id));
151 if (!stream) 155 if (!stream)
152 return false; 156 return false;
153 157
154 if (!stream->Open()) { 158 if (!stream->Open()) {
155 stream->Close(); 159 stream->Close();
156 return false; 160 return false;
157 } 161 }
158 162
159 const int stream_id = audio_stream_id_++;
160 audio_stream_ids_[stream] = stream_id; 163 audio_stream_ids_[stream] = stream_id;
161 audio_log_->OnCreated( 164 audio_log_->OnCreated(
162 stream_id, params_, device_id_); 165 stream_id, params_, device_id_);
163 166
164 idle_streams_.push_back(stream); 167 idle_streams_.push_back(stream);
165 return true; 168 return true;
166 } 169 }
167 170
168 void AudioOutputDispatcherImpl::CloseAllIdleStreams() { 171 void AudioOutputDispatcherImpl::CloseAllIdleStreams() {
169 DCHECK(task_runner_->BelongsToCurrentThread()); 172 DCHECK(task_runner_->BelongsToCurrentThread());
(...skipping 10 matching lines...) Expand all
180 183
181 AudioStreamIDMap::iterator it = audio_stream_ids_.find(stream); 184 AudioStreamIDMap::iterator it = audio_stream_ids_.find(stream);
182 DCHECK(it != audio_stream_ids_.end()); 185 DCHECK(it != audio_stream_ids_.end());
183 audio_log_->OnClosed(it->second); 186 audio_log_->OnClosed(it->second);
184 audio_stream_ids_.erase(it); 187 audio_stream_ids_.erase(it);
185 } 188 }
186 idle_streams_.erase(idle_streams_.begin() + keep_alive, idle_streams_.end()); 189 idle_streams_.erase(idle_streams_.begin() + keep_alive, idle_streams_.end());
187 } 190 }
188 191
189 } // namespace media 192 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_manager_base.cc ('k') | media/audio/audio_output_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698