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

Unified Diff: media/audio/audio_output_resampler.h

Issue 899923003: Purge AudioOutputDispatcher after close delay if no proxies exist. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comments. Created 5 years, 10 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 | « media/audio/audio_output_proxy_unittest.cc ('k') | media/audio/audio_output_resampler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_output_resampler.h
diff --git a/media/audio/audio_output_resampler.h b/media/audio/audio_output_resampler.h
index 4c7be29830ecebf6ac12c2150c59a0145c4d444b..18d4905b801bf84f859aa6e240f4bb589e947cf2 100644
--- a/media/audio/audio_output_resampler.h
+++ b/media/audio/audio_output_resampler.h
@@ -10,9 +10,10 @@
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "base/time/time.h"
+#include "base/timer/timer.h"
#include "media/audio/audio_io.h"
#include "media/audio/audio_manager.h"
-#include "media/audio/audio_output_dispatcher.h"
+#include "media/audio/audio_output_dispatcher_impl.h"
#include "media/audio/audio_parameters.h"
namespace media {
@@ -29,12 +30,7 @@ class OnMoreDataConverter;
//
// 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
+// parameters. If opening still fails, it will fallback to AUDIO_FAKE.
class MEDIA_EXPORT AudioOutputResampler : public AudioOutputDispatcher {
public:
AudioOutputResampler(AudioManager* audio_manager,
@@ -60,11 +56,14 @@ class MEDIA_EXPORT AudioOutputResampler : public AudioOutputDispatcher {
// appropriate output parameters in error situations.
void SetupFallbackParams();
- // Used to initialize and reinitialize |dispatcher_|.
+ // Used to reinitialize |dispatcher_|.
+ void Reinitialize();
+
+ // Used to initialize |dispatcher_|.
void Initialize();
// Dispatcher to proxy all AudioOutputDispatcher calls too.
- scoped_refptr<AudioOutputDispatcher> dispatcher_;
+ scoped_refptr<AudioOutputDispatcherImpl> dispatcher_;
// Map of outstanding OnMoreDataConverter objects. A new object is created
// on every StartStream() call and destroyed on CloseStream().
@@ -74,13 +73,22 @@ class MEDIA_EXPORT AudioOutputResampler : public AudioOutputDispatcher {
// Used by AudioOutputDispatcherImpl; kept so we can reinitialize on the fly.
base::TimeDelta close_delay_;
- // AudioParameters used to setup the output stream.
+ // AudioParameters used to setup the output stream; changed upon fallback.
AudioParameters output_params_;
+ // The original AudioParameters we were constructed with.
+ const AudioParameters original_output_params_;
+
// Whether any streams have been opened through |dispatcher_|, if so we can't
// fallback on future OpenStream() failures.
bool streams_opened_;
+ // The reinitialization timer provides a way to recover from temporary failure
+ // states by clearing the dispatcher if all proxies have been closed and none
+ // have been created within |close_delay_|. Without this, audio may be lost
+ // to a fake stream indefinitely for transient errors.
+ base::Timer reinitialize_timer_;
+
DISALLOW_COPY_AND_ASSIGN(AudioOutputResampler);
};
« no previous file with comments | « media/audio/audio_output_proxy_unittest.cc ('k') | media/audio/audio_output_resampler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698