Index: media/audio/win/audio_low_latency_input_win.h |
diff --git a/media/audio/win/audio_low_latency_input_win.h b/media/audio/win/audio_low_latency_input_win.h |
index 09aeaf9976520f012abe79822ef3d7b0eb5619d5..fa7505e84c16097e94636aa97507834508890ed4 100644 |
--- a/media/audio/win/audio_low_latency_input_win.h |
+++ b/media/audio/win/audio_low_latency_input_win.h |
@@ -75,18 +75,21 @@ |
#include "base/win/scoped_comptr.h" |
#include "base/win/scoped_handle.h" |
#include "media/audio/agc_audio_stream.h" |
+#include "media/base/audio_converter.h" |
#include "media/base/audio_parameters.h" |
#include "media/base/media_export.h" |
namespace media { |
class AudioBus; |
+class AudioFifo; |
class AudioManagerWin; |
// AudioInputStream implementation using Windows Core Audio APIs. |
class MEDIA_EXPORT WASAPIAudioInputStream |
: public AgcAudioStream<AudioInputStream>, |
public base::DelegateSimpleThread::Delegate, |
+ public AudioConverter::InputCallback, |
NON_EXPORTED_BASE(public base::NonThreadSafe) { |
public: |
// The ctor takes all the usual parameters, plus |manager| which is the |
@@ -125,6 +128,9 @@ class MEDIA_EXPORT WASAPIAudioInputStream |
HRESULT InitializeAudioEngine(); |
void ReportOpenResult() const; |
+ // AudioConverter::InputCallback implementation. |
+ double ProvideInput(AudioBus* audio_bus, uint32_t frames_delayed) override; |
+ |
// Used to track down where we fail during initialization which at the |
// moment seems to be happening frequently and we're not sure why. |
// The reason might be expected (e.g. trying to open "default" on a machine |
@@ -146,7 +152,8 @@ class MEDIA_EXPORT WASAPIAudioInputStream |
OPEN_RESULT_SET_EVENT_HANDLE = 11, |
OPEN_RESULT_NO_CAPTURE_CLIENT = 12, |
OPEN_RESULT_NO_AUDIO_VOLUME = 13, |
- OPEN_RESULT_MAX = OPEN_RESULT_NO_AUDIO_VOLUME |
+ OPEN_RESULT_OK_WITH_RESAMPLING = 14, |
+ OPEN_RESULT_MAX = OPEN_RESULT_OK_WITH_RESAMPLING |
}; |
// Our creator, the audio manager needs to be notified when we close. |
@@ -243,6 +250,13 @@ class MEDIA_EXPORT WASAPIAudioInputStream |
// indicates that we need to unmute the system audio when stopping capturing. |
bool mute_done_ = false; |
+ // If the caller requires resampling (should only be in exceptional cases and |
+ // ideally, never), we support using an AudioConverter. |
+ std::unique_ptr<AudioConverter> converter_; |
+ std::unique_ptr<AudioBus> convert_bus_; |
+ std::unique_ptr<AudioFifo> convert_fifo_; |
+ int data_was_converted_ = 0; |
+ |
DISALLOW_COPY_AND_ASSIGN(WASAPIAudioInputStream); |
}; |