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

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

Issue 2896423003: Remove Mac input audio restart mechanism and reduce time until startup success check. (Closed)
Patch Set: Created 3 years, 7 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 b30b604193b55cba4101cf23f6428cf31b82a60b..df2f7a7315487a6f21a6ed6fa70e503dd947b9d3 100644
--- a/media/audio/mac/audio_low_latency_input_mac.h
+++ b/media/audio/mac/audio_low_latency_input_mac.h
@@ -130,9 +130,6 @@ class MEDIA_EXPORT AUAudioInputStream
// (CrBrowserMain) which is the same thread as this instance is created on.
void DevicePropertyChangedOnMainThread(const std::vector<UInt32>& properties);
- // Updates |last_callback_time_| on the main browser thread.
- void UpdateDataCallbackTimeOnMainThread(base::TimeTicks now_tick);
-
// Registers OnDevicePropertyChanged() to receive notifications when device
// properties changes.
void RegisterDeviceChangeListener();
@@ -162,22 +159,12 @@ class MEDIA_EXPORT AUAudioInputStream
// 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().
+ // expires some time after calling Start().
void CheckInputStartupSuccess();
- // Checks (periodically) if a stream is alive by comparing the current time
- // with the last timestamp stored in a data callback. Calls RestartAudio()
- // when a restart is required.
- void CheckIfInputStreamIsAlive();
-
// Uninitializes the audio unit if needed.
void CloseAudioUnit();
- // Called by CheckIfInputStreamIsAlive() on the main thread when an audio
- // restarts is required. Restarts the existing audio stream reusing the
- // current audio parameters.
- void RestartAudio();
-
// Adds extra UMA stats when it has been detected that startup failed.
void AddHistogramsForFailedStartup();
@@ -252,8 +239,14 @@ class MEDIA_EXPORT AUAudioInputStream
// 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.
+ // Flags to indicate if we have gotten an input callback.
+ // |got_input_callback_| is only accessed on the OS audio thread in
+ // OnDataIsAvailable() and is set to true when the first callback comes. It
+ // acts as a gate to only set |input_callback_is_active_| atomically once.
+ // |got_input_callback_| is reset to false in Stop() on the main thread. This
+ // is safe since after stopping the audio unit there is no current callback
+ // ongoing and no further callbacks coming.
+ bool got_input_callback_;
base::subtle::Atomic32 input_callback_is_active_;
// Timer which triggers CheckInputStartupSuccess() to verify that input
@@ -301,30 +294,6 @@ class MEDIA_EXPORT AUAudioInputStream
UInt32 largest_glitch_frames_;
int glitches_detected_;
- // Timer that provides periodic callbacks used to monitor if the input stream
- // is alive or not.
- std::unique_ptr<base::RepeatingTimer> check_alive_timer_;
-
- // Time tick set once in each input data callback. The time is measured on
- // the real-time priority I/O thread but this member is modified and read
- // on the main thread only.
- base::TimeTicks last_callback_time_;
-
- // Counts number of times we get a signal of that a restart seems required.
- // If it is above a threshold (kNumberOfIndicationsToTriggerRestart), the
- // current audio stream is closed and a new (using same audio parameters) is
- // started.
- size_t number_of_restart_indications_;
-
- // Counts number of times RestartAudio() has been called. The max number of
- // attempts is restricted by |kMaxNumberOfRestartAttempts|.
- // Note that this counter is reset to zero after each successful restart.
- size_t number_of_restart_attempts_;
-
- // Counts the total number of times RestartAudio() has been called. It is
- // set to zero once in the constructor and then never reset again.
- size_t total_number_of_restart_attempts_;
-
// Callback to send statistics info.
AudioManager::LogCallback log_callback_;
« 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