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

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

Issue 108113004: Merge 233843 "Ensure the wedge timer isn't started until after S..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1700/src/
Patch Set: 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 | « no previous file | no next file » | 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_controller.h" 5 #include "media/audio/audio_output_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 #if defined(AUDIO_POWER_MONITORING) 191 #if defined(AUDIO_POWER_MONITORING)
192 power_monitor_.Reset(); 192 power_monitor_.Reset();
193 power_poll_callback_.Reset( 193 power_poll_callback_.Reset(
194 base::Bind(&AudioOutputController::ReportPowerMeasurementPeriodically, 194 base::Bind(&AudioOutputController::ReportPowerMeasurementPeriodically,
195 this)); 195 this));
196 // Run the callback to send an initial notification that we're starting in 196 // Run the callback to send an initial notification that we're starting in
197 // silence, and to schedule periodic callbacks. 197 // silence, and to schedule periodic callbacks.
198 power_poll_callback_.callback().Run(); 198 power_poll_callback_.callback().Run();
199 #endif 199 #endif
200 200
201 on_more_io_data_called_ = 0;
202 AllowEntryToOnMoreIOData();
203 stream_->Start(this);
204
201 // For UMA tracking purposes, start the wedge detection timer. This allows us 205 // For UMA tracking purposes, start the wedge detection timer. This allows us
202 // to record statistics about the number of wedged playbacks in the field. 206 // to record statistics about the number of wedged playbacks in the field.
203 // 207 //
204 // WedgeCheck() will look to see if |on_more_io_data_called_| is true after 208 // WedgeCheck() will look to see if |on_more_io_data_called_| is true after
205 // the timeout expires. Care must be taken to ensure the wedge check delay is 209 // the timeout expires. Care must be taken to ensure the wedge check delay is
206 // large enough that the value isn't queried while OnMoreDataIO() is setting 210 // large enough that the value isn't queried while OnMoreDataIO() is setting
207 // it. 211 // it.
208 // 212 //
209 // Timer self-manages its lifetime and WedgeCheck() will only record the UMA 213 // Timer self-manages its lifetime and WedgeCheck() will only record the UMA
210 // statistic if state is still kPlaying. Additional Start() calls will 214 // statistic if state is still kPlaying. Additional Start() calls will
211 // invalidate the previous timer. 215 // invalidate the previous timer.
212 wedge_timer_.reset(new base::OneShotTimer<AudioOutputController>()); 216 wedge_timer_.reset(new base::OneShotTimer<AudioOutputController>());
213 wedge_timer_->Start( 217 wedge_timer_->Start(
214 FROM_HERE, TimeDelta::FromSeconds(3), this, 218 FROM_HERE, TimeDelta::FromSeconds(5), this,
215 &AudioOutputController::WedgeCheck); 219 &AudioOutputController::WedgeCheck);
216 on_more_io_data_called_ = 0;
217
218 AllowEntryToOnMoreIOData();
219 stream_->Start(this);
220 220
221 handler_->OnPlaying(); 221 handler_->OnPlaying();
222 } 222 }
223 223
224 #if defined(AUDIO_POWER_MONITORING) 224 #if defined(AUDIO_POWER_MONITORING)
225 void AudioOutputController::ReportPowerMeasurementPeriodically() { 225 void AudioOutputController::ReportPowerMeasurementPeriodically() {
226 DCHECK(message_loop_->BelongsToCurrentThread()); 226 DCHECK(message_loop_->BelongsToCurrentThread());
227 const std::pair<float, bool>& reading = 227 const std::pair<float, bool>& reading =
228 power_monitor_.ReadCurrentPowerAndClip(); 228 power_monitor_.ReadCurrentPowerAndClip();
229 handler_->OnPowerMeasured(reading.first, reading.second); 229 handler_->OnPowerMeasured(reading.first, reading.second);
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 UMA_HISTOGRAM_BOOLEAN( 484 UMA_HISTOGRAM_BOOLEAN(
485 "Media.AudioOutputControllerPlaybackStartupSuccess", playback_success); 485 "Media.AudioOutputControllerPlaybackStartupSuccess", playback_success);
486 486
487 // Let the AudioManager try and fix it. 487 // Let the AudioManager try and fix it.
488 if (!playback_success) 488 if (!playback_success)
489 audio_manager_->FixWedgedAudio(); 489 audio_manager_->FixWedgedAudio();
490 } 490 }
491 } 491 }
492 492
493 } // namespace media 493 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698