| Index: webrtc/modules/audio_device/ios/audio_device_ios.h
|
| diff --git a/webrtc/modules/audio_device/ios/audio_device_ios.h b/webrtc/modules/audio_device/ios/audio_device_ios.h
|
| index 8e630dd1a8d656d018ba30bd8606ae533652a684..816976ce2da77ecbba70ac6f97effdec24c19da6 100644
|
| --- a/webrtc/modules/audio_device/ios/audio_device_ios.h
|
| +++ b/webrtc/modules/audio_device/ios/audio_device_ios.h
|
| @@ -14,7 +14,6 @@
|
| #include <memory>
|
|
|
| #include "WebRTC/RTCMacros.h"
|
| -#include "webrtc/base/asyncinvoker.h"
|
| #include "webrtc/base/thread.h"
|
| #include "webrtc/base/thread_checker.h"
|
| #include "webrtc/modules/audio_device/audio_device_generic.h"
|
| @@ -42,7 +41,8 @@ class FineAudioBuffer;
|
| // same thread.
|
| class AudioDeviceIOS : public AudioDeviceGeneric,
|
| public AudioSessionObserver,
|
| - public VoiceProcessingAudioUnitObserver {
|
| + public VoiceProcessingAudioUnitObserver,
|
| + public rtc::MessageHandler {
|
| public:
|
| AudioDeviceIOS();
|
| ~AudioDeviceIOS();
|
| @@ -162,7 +162,7 @@ class AudioDeviceIOS : public AudioDeviceGeneric,
|
| void OnInterruptionBegin() override;
|
| void OnInterruptionEnd() override;
|
| void OnValidRouteChange() override;
|
| - void OnConfiguredForWebRTC() override;
|
| + void OnCanPlayOrRecordChange(bool can_play_or_record) override;
|
|
|
| // VoiceProcessingAudioUnitObserver methods.
|
| OSStatus OnDeliverRecordedData(AudioUnitRenderActionFlags* flags,
|
| @@ -175,13 +175,18 @@ class AudioDeviceIOS : public AudioDeviceGeneric,
|
| UInt32 bus_number,
|
| UInt32 num_frames,
|
| AudioBufferList* io_data) override;
|
| + void OnSampleRateChange(float sample_rate) override;
|
| +
|
| + // Handles messages from posts.
|
| + void OnMessage(rtc::Message *msg) override;
|
|
|
| private:
|
| // Called by the relevant AudioSessionObserver methods on |thread_|.
|
| void HandleInterruptionBegin();
|
| void HandleInterruptionEnd();
|
| void HandleValidRouteChange();
|
| - void HandleConfiguredForWebRTC();
|
| + void HandleCanPlayOrRecordChange(bool can_play_or_record);
|
| + void HandleSampleRateChange(float sample_rate);
|
|
|
| // Uses current |playout_parameters_| and |record_parameters_| to inform the
|
| // audio device buffer (ADB) about our internal audio parameters.
|
| @@ -201,6 +206,11 @@ class AudioDeviceIOS : public AudioDeviceGeneric,
|
| // a BT headset is enabled or disabled.
|
| bool RestartAudioUnit(float sample_rate);
|
|
|
| + // Configures the audio session for WebRTC.
|
| + void ConfigureAudioSession();
|
| + // Unconfigures the audio session.
|
| + void UnconfigureAudioSession();
|
| +
|
| // Activates our audio session, creates and initializes the voice-processing
|
| // audio unit and verifies that we got the preferred native audio parameters.
|
| bool InitPlayOrRecord();
|
| @@ -213,8 +223,6 @@ class AudioDeviceIOS : public AudioDeviceGeneric,
|
| rtc::ThreadChecker thread_checker_;
|
| // Thread that this object is created on.
|
| rtc::Thread* thread_;
|
| - // Invoker used to execute methods on thread_.
|
| - std::unique_ptr<rtc::AsyncInvoker> async_invoker_;
|
|
|
| // Raw pointer handle provided to us in AttachAudioBuffer(). Owned by the
|
| // AudioDeviceModuleImpl class and called by AudioDeviceModule::Create().
|
| @@ -284,6 +292,9 @@ class AudioDeviceIOS : public AudioDeviceGeneric,
|
|
|
| // Audio interruption observer instance.
|
| RTCAudioSessionDelegateAdapter* audio_session_observer_;
|
| +
|
| + // Set to true if we've activated the audio session.
|
| + bool has_configured_session_;
|
| };
|
|
|
| } // namespace webrtc
|
|
|