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

Unified Diff: media/audio/audio_output_resampler.h

Issue 10958020: Don't fallback if we've successfully opened a stream previously. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments w/o state machine. 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 1c2276ab62060710f16e567d9d6b234bc6ec40c1..764343777b3bcf888fd1700b6b72c47361dd464b 100644
--- a/media/audio/audio_output_resampler.h
+++ b/media/audio/audio_output_resampler.h
@@ -9,7 +9,6 @@
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
-#include "base/synchronization/lock.h"
#include "base/time.h"
#include "media/audio/audio_io.h"
#include "media/audio/audio_manager.h"
@@ -43,8 +42,7 @@ class OnMoreDataResampler;
//
// Currently channel downmixing and upmixing is not supported.
// TODO(dalecurtis): Add channel remixing. http://crbug.com/138762
-class MEDIA_EXPORT AudioOutputResampler
- : public AudioOutputDispatcher {
+class MEDIA_EXPORT AudioOutputResampler : public AudioOutputDispatcher {
public:
AudioOutputResampler(AudioManager* audio_manager,
const AudioParameters& input_params,
@@ -71,11 +69,10 @@ class MEDIA_EXPORT AudioOutputResampler
// Dispatcher to proxy all AudioOutputDispatcher calls too.
scoped_refptr<AudioOutputDispatcher> dispatcher_;
- // Vector of each outstanding OnMoreDataResampler object. A new instance is
- // created on every StartStream() call. Access must be locked.
+ // Map of outstanding OnMoreDataResampler objects. A new object is created
+ // on every StartStream() call and destroyed on CloseStream().
typedef std::map<AudioOutputProxy*, OnMoreDataResampler*> CallbackMap;
CallbackMap callbacks_;
- base::Lock callbacks_lock_;
// Ratio of input bytes to output bytes used to correct playback delay with
// regard to buffering and resampling.
@@ -87,6 +84,10 @@ class MEDIA_EXPORT AudioOutputResampler
// AudioParameters used to setup the output stream.
AudioParameters output_params_;
+ // Whether any streams have been opened through |dispatcher_|, if so we can't
+ // fallback on future OpenStream() failures.
+ bool streams_opened_;
+
DISALLOW_COPY_AND_ASSIGN(AudioOutputResampler);
};

Powered by Google App Engine
This is Rietveld 408576698