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

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

Issue 61203008: Attempt to fix audio wedges by restarting all streams. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 #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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 53
54 close_timer_.Reset(); 54 close_timer_.Reset();
55 return true; 55 return true;
56 } 56 }
57 57
58 bool AudioOutputDispatcherImpl::StartStream( 58 bool AudioOutputDispatcherImpl::StartStream(
59 AudioOutputStream::AudioSourceCallback* callback, 59 AudioOutputStream::AudioSourceCallback* callback,
60 AudioOutputProxy* stream_proxy) { 60 AudioOutputProxy* stream_proxy) {
61 DCHECK(message_loop_->BelongsToCurrentThread()); 61 DCHECK(message_loop_->BelongsToCurrentThread());
62 DCHECK(proxy_to_physical_map_.find(stream_proxy) ==
63 proxy_to_physical_map_.end());
62 64
63 if (idle_streams_.empty() && !CreateAndOpenStream()) 65 if (idle_streams_.empty() && !CreateAndOpenStream())
64 return false; 66 return false;
65 67
66 AudioOutputStream* physical_stream = idle_streams_.back(); 68 AudioOutputStream* physical_stream = idle_streams_.back();
67 DCHECK(physical_stream); 69 DCHECK(physical_stream);
68 idle_streams_.pop_back(); 70 idle_streams_.pop_back();
69 71
70 DCHECK_GT(paused_proxies_, 0u); 72 DCHECK_GT(paused_proxies_, 0u);
71 --paused_proxies_; 73 --paused_proxies_;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 return false; 172 return false;
171 173
172 if (!stream->Open()) { 174 if (!stream->Open()) {
173 stream->Close(); 175 stream->Close();
174 return false; 176 return false;
175 } 177 }
176 idle_streams_.push_back(stream); 178 idle_streams_.push_back(stream);
177 return true; 179 return true;
178 } 180 }
179 181
180 // This method is called by |close_timer_|. 182 // This method is called by |close_timer_|.
scherkus (not reviewing) 2013/12/02 21:49:37 comment no longer valid (perhaps just remove it?)
DaleCurtis 2013/12/02 22:23:59 All this is taken care of in my AOD cleanup CL, wh
181 void AudioOutputDispatcherImpl::ClosePendingStreams() { 183 void AudioOutputDispatcherImpl::ClosePendingStreams() {
scherkus (not reviewing) 2013/12/02 21:49:37 OOC any reason why this isn't called CloseIdleStre
DaleCurtis 2013/12/02 22:23:59 Ditto.
182 DCHECK(message_loop_->BelongsToCurrentThread()); 184 DCHECK(message_loop_->BelongsToCurrentThread());
183 while (!idle_streams_.empty()) { 185 while (!idle_streams_.empty()) {
184 idle_streams_.back()->Close(); 186 idle_streams_.back()->Close();
185 idle_streams_.pop_back(); 187 idle_streams_.pop_back();
186 } 188 }
187 } 189 }
188 190
191 void AudioOutputDispatcherImpl::CloseStreamsForWedgeFix() {
192 DCHECK(message_loop_->BelongsToCurrentThread());
193 ClosePendingStreams();
scherkus (not reviewing) 2013/12/02 21:49:37 it seems this only closes idle_streams_ do we nee
DaleCurtis 2013/12/02 22:23:59 For 1) AODI doesn't track the AudioSourceCallback
194 }
195
196 void AudioOutputDispatcherImpl::RestartStreamsForWedgeFix() {
197 DCHECK(message_loop_->BelongsToCurrentThread());
198
199 // Should only be called when the dispatcher is used with fake streams which
200 // don't need to be shutdown or restarted.
201 CHECK_EQ(params_.format(), AudioParameters::AUDIO_FAKE);
202 }
203
189 } // namespace media 204 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698