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

Unified Diff: media/audio/audio_output_resampler.h

Issue 10909151: Automatically fall back to non-low latency on open() failure. (Closed) Base URL: http://git.chromium.org/chromium/src.git@resampler2
Patch Set: Rebase. Comments. Created 8 years, 3 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
Index: media/audio/audio_output_resampler.h
diff --git a/media/audio/audio_output_resampler.h b/media/audio/audio_output_resampler.h
index 7f5ea212bf9b7a2af56c8ede3c4912a598aa368a..2a8850356d605e47de4add0656b16d5be7acf67a 100644
--- a/media/audio/audio_output_resampler.h
+++ b/media/audio/audio_output_resampler.h
@@ -32,6 +32,14 @@ class MultiChannelResampler;
// and redirecting to the appropriate resampling or FIFO callback which passes
// through to the original callback only when necessary.
//
+// AOR will automatically fall back from AUDIO_PCM_LOW_LATENCY to
+// AUDIO_PCM_LINEAR if the output device fails to open at the requested output
+// parameters.
+// TODO(dalecurtis): Ideally the low latency path will be as reliable as the
+// high latency path once we have channel mixing and support querying for the
+// hardware's configured bit depth. Monitor the UMA stats for fallback and
+// remove fallback support once it's stable. http://crbug.com/148418
+//
// Currently channel downmixing and upmixing is not supported.
// TODO(dalecurtis): Add channel remixing. http://crbug.com/138762
class MEDIA_EXPORT AudioOutputResampler
@@ -66,6 +74,10 @@ class MEDIA_EXPORT AudioOutputResampler
friend class base::RefCountedThreadSafe<AudioOutputResampler>;
virtual ~AudioOutputResampler();
+ // Used to initialize the FIFO and resamplers. |record_stats| indicates if
+ // UMA statistics should be recorded about the hardware configuration.
+ void Initialize(bool record_stats);
+
// Called by MultiChannelResampler when more data is necessary.
void ProvideInput(AudioBus* audio_bus);
@@ -98,9 +110,8 @@ class MEDIA_EXPORT AudioOutputResampler
// regard to buffering and resampling.
double io_ratio_;
- // Helper values for determining playback delay adjustment.
- int input_bytes_per_frame_;
- int output_bytes_per_frame_;
+ // Used by AudioOutputDispatcherImpl; kept so we can reinitialize on the fly.
+ base::TimeDelta close_delay_;
// Last AudioBuffersState object received via OnMoreData(), used to correct
// playback delay by ProvideInput() and passed on to |source_callback_|.
@@ -110,6 +121,9 @@ class MEDIA_EXPORT AudioOutputResampler
// or FIFO buffers which have not been sent to the audio device.
int outstanding_audio_bytes_;
+ // AudioParameters used to setup the output stream.
+ AudioParameters output_params_;
+
DISALLOW_COPY_AND_ASSIGN(AudioOutputResampler);
};

Powered by Google App Engine
This is Rietveld 408576698