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

Unified Diff: media/audio/audio_output_resampler.h

Issue 2582703003: Audio output debug recording. (Closed)
Patch Set: Using callbacks instead. Created 3 years, 11 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 da512e09ebc345934a326a8c367678f639678067..38dd6c182c7fbfff8905c72ce2596e77ecaa871f 100644
--- a/media/audio/audio_output_resampler.h
+++ b/media/audio/audio_output_resampler.h
@@ -31,6 +31,16 @@ class OnMoreDataConverter;
// parameters. If opening still fails, it will fallback to AUDIO_FAKE.
class MEDIA_EXPORT AudioOutputResampler : public AudioOutputDispatcher {
public:
+ // Callbacks for debug recording. RegisterDebugRecordingSourceCallback is used
+ // for registering a stream so that recording can be setup. The Unregister-
+ // counterpart ungeisters for shutting down recording. DebugRecordingCallback
+ // is used for passing data. The int in all callbacks is a unique id to
+ // identify the stream.
+ using RegisterDebugRecordingSourceCallback =
+ base::Callback<void(int, const AudioParameters&)>;
+ using UnregisterDebugRecordingSourceCallback = base::Callback<void(int)>;
+ using DebugRecordingCallback = base::Callback<void(int, AudioBus*)>;
+
AudioOutputResampler(AudioManager* audio_manager,
const AudioParameters& input_params,
const AudioParameters& output_params,
@@ -47,6 +57,14 @@ class MEDIA_EXPORT AudioOutputResampler : public AudioOutputDispatcher {
void StreamVolumeSet(AudioOutputProxy* stream_proxy, double volume) override;
void CloseStream(AudioOutputProxy* stream_proxy) override;
+ // Sets debug recording callbacks. See comment on callback definitions above.
+ void SetDebugRecordingCallbacks(
+ const RegisterDebugRecordingSourceCallback&
+ register_debug_recording_source_callback,
+ const UnregisterDebugRecordingSourceCallback&
+ unregister_debug_recording_source_callback,
+ const DebugRecordingCallback& debug_recording_callback);
+
private:
using CallbackMap =
std::map<AudioOutputProxy*, std::unique_ptr<OnMoreDataConverter>>;
@@ -90,6 +108,13 @@ class MEDIA_EXPORT AudioOutputResampler : public AudioOutputDispatcher {
// to a fake stream indefinitely for transient errors.
base::Timer reinitialize_timer_;
+ // Used for audio debug recordings. See comment on callback definitions above.
+ RegisterDebugRecordingSourceCallback
+ register_debug_recording_source_callback_;
+ UnregisterDebugRecordingSourceCallback
+ unregister_debug_recording_source_callback_;
+ DebugRecordingCallback debug_recording_callback_;
+
base::WeakPtrFactory<AudioOutputResampler> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(AudioOutputResampler);
};

Powered by Google App Engine
This is Rietveld 408576698