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

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: Fix mock. Created 7 years 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
« 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 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 181
180 // This method is called by |close_timer_|. 182 // This method is called by |close_timer_|.
181 void AudioOutputDispatcherImpl::ClosePendingStreams() { 183 void AudioOutputDispatcherImpl::ClosePendingStreams() {
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 while (!pausing_streams_.empty()) {
194 idle_streams_.push_back(pausing_streams_.back());
195 pausing_streams_.pop_back();
196 }
197 ClosePendingStreams();
198 }
199
200 void AudioOutputDispatcherImpl::RestartStreamsForWedgeFix() {
201 DCHECK(message_loop_->BelongsToCurrentThread());
202
203 // Should only be called when the dispatcher is used with fake streams which
204 // don't need to be shutdown or restarted.
205 CHECK_EQ(params_.format(), AudioParameters::AUDIO_FAKE);
206 }
207
189 } // namespace media 208 } // 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