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

Unified Diff: media/audio/audio_output_controller.h

Issue 22339024: Crash fix: Remove MessageLoop from AudioPowerMonitor and instead use MessageLoopProxy in AudioOutpu… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: boolean style Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/audio/audio_output_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_output_controller.h
diff --git a/media/audio/audio_output_controller.h b/media/audio/audio_output_controller.h
index 5182453f2b7bb15c3f71637364a73528f8f063b9..38a2c03f590faa18dd9c2ca65cf559da6feff23b 100644
--- a/media/audio/audio_output_controller.h
+++ b/media/audio/audio_output_controller.h
@@ -9,10 +9,9 @@
#include "base/callback.h"
#include "base/cancelable_callback.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/timer/timer.h"
#include "media/audio/audio_io.h"
#include "media/audio/audio_manager.h"
+#include "media/audio/audio_power_monitor.h"
#include "media/audio/audio_source_diverter.h"
#include "media/audio/simple_sources.h"
#include "media/base/media_export.h"
@@ -53,8 +52,6 @@
namespace media {
-class AudioPowerMonitor;
-
class MEDIA_EXPORT AudioOutputController
: public base::RefCountedThreadSafe<AudioOutputController>,
public AudioOutputStream::AudioSourceCallback,
@@ -182,9 +179,9 @@ class MEDIA_EXPORT AudioOutputController
void DoStartDiverting(AudioOutputStream* to_stream);
void DoStopDiverting();
- // Called at regular intervals during playback to check for a change in
- // silence and call EventHandler::OnAudible() when state changes occur.
- void MaybeInvokeAudibleCallback();
+ // Calls EventHandler::OnPowerMeasured() with the current power level and then
+ // schedules itself to be called again later.
+ void ReportPowerMeasurementPeriodically();
// Helper method that stops the physical stream.
void StopStream();
@@ -234,11 +231,11 @@ class MEDIA_EXPORT AudioOutputController
// Number of times left.
int number_polling_attempts_left_;
- // Scans audio samples from OnMoreIOData() as input and causes
- // EventHandler::OnPowerMeasured() to be called with power level measurements
- // at regular intervals.
- scoped_ptr<AudioPowerMonitor> power_monitor_;
- base::CancelableCallback<void(float, bool)> power_monitor_callback_;
+ // Scans audio samples from OnMoreIOData() as input to compute power levels.
+ AudioPowerMonitor power_monitor_;
+
+ // Periodic callback to report power levels during playback.
+ base::CancelableClosure power_poll_callback_;
DISALLOW_COPY_AND_ASSIGN(AudioOutputController);
};
« no previous file with comments | « no previous file | media/audio/audio_output_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698