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

Unified Diff: media/audio/mac/audio_low_latency_input_mac.h

Issue 1407333005: Adds Media.Audio.InputStartupSuccessMac UMA stat for Mac OS X (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments from tommi@ Created 5 years, 2 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/mac/audio_low_latency_input_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/mac/audio_low_latency_input_mac.h
diff --git a/media/audio/mac/audio_low_latency_input_mac.h b/media/audio/mac/audio_low_latency_input_mac.h
index abbac4b332a156c04fe8b7fb4dc9a89720aa8d53..e1d14b33be88ba34489bd8f411686f97c33064b0 100644
--- a/media/audio/mac/audio_low_latency_input_mac.h
+++ b/media/audio/mac/audio_low_latency_input_mac.h
@@ -39,10 +39,13 @@
#include <AudioUnit/AudioUnit.h>
#include <CoreAudio/CoreAudio.h>
+#include "base/atomicops.h"
#include "base/cancelable_callback.h"
#include "base/memory/scoped_ptr.h"
#include "base/synchronization/lock.h"
+#include "base/threading/thread_checker.h"
#include "base/time/time.h"
+#include "base/timer/timer.h"
#include "media/audio/agc_audio_stream.h"
#include "media/audio/audio_io.h"
#include "media/audio/audio_parameters.h"
@@ -114,8 +117,21 @@ class AUAudioInputStream : public AgcAudioStream<AudioInputStream> {
// channel.
bool IsVolumeSettableOnChannel(int channel);
+ // Helper methods to set and get atomic |input_callback_is_active_|.
+ void SetInputCallbackIsActive(bool active);
+ bool GetInputCallbackIsActive();
+
+ // Checks if a stream was started successfully and the audio unit also starts
+ // to call InputProc() as it should. This method is called once when a timer
+ // expires 5 seconds after calling Start().
+ void CheckInputStartupSuccess();
+
+ // Verifies that Open(), Start(), Stop() and Close() are all called on the
+ // creating thread which is the main browser thread (CrBrowserMain) on Mac.
+ base::ThreadChecker thread_checker_;
+
// Our creator, the audio manager needs to be notified when we close.
- AudioManagerMac* manager_;
+ AudioManagerMac* const manager_;
// Contains the desired number of audio frames in each callback.
const size_t number_of_frames_;
@@ -133,7 +149,7 @@ class AUAudioInputStream : public AgcAudioStream<AudioInputStream> {
AudioUnit audio_unit_;
// The UID refers to the current input audio device.
- AudioDeviceID input_device_id_;
+ const AudioDeviceID input_device_id_;
// Provides a mechanism for encapsulating one or more buffers of audio data.
AudioBufferList audio_buffer_list_;
@@ -164,6 +180,15 @@ class AUAudioInputStream : public AgcAudioStream<AudioInputStream> {
// if length of error sequence is above a certain limit.
base::TimeTicks last_success_time_;
+ // Is set to true on the internal AUHAL IO thread in the first input callback
+ // after Start() has bee called.
+ base::subtle::Atomic32 input_callback_is_active_;
+
+ // Timer which triggers CheckInputStartupSuccess() to verify that input
+ // callbacks have started as intended after a successful call to Start().
+ // This timer lives on the main browser thread.
+ scoped_ptr<base::OneShotTimer> input_callback_timer_;
+
DISALLOW_COPY_AND_ASSIGN(AUAudioInputStream);
};
« no previous file with comments | « no previous file | media/audio/mac/audio_low_latency_input_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698