AudioDeviceImpl cleanup

(Making new attempt to land https://webrtc-review.googlesource.com/c/src/+/7601)

TBR=solenberg

Bug: NONE
Change-Id: I0651c47066dbc413b03c899b437d8ac18844a1e6
Reviewed-on: https://webrtc-review.googlesource.com/8380
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20246}
This commit is contained in:
henrika 2017-10-11 13:16:17 +02:00 committed by Commit Bot
parent c5bb00b6bf
commit 4af7366961
3 changed files with 306 additions and 768 deletions

View file

@ -68,6 +68,7 @@ AudioDeviceBuffer::AudioDeviceBuffer()
phase_ = 0.0; phase_ = 0.0;
LOG(WARNING) << "AUDIO_DEVICE_PLAYS_SINUS_TONE is defined!"; LOG(WARNING) << "AUDIO_DEVICE_PLAYS_SINUS_TONE is defined!";
#endif #endif
WebRtcSpl_Init();
playout_thread_checker_.DetachFromThread(); playout_thread_checker_.DetachFromThread();
recording_thread_checker_.DetachFromThread(); recording_thread_checker_.DetachFromThread();
} }

File diff suppressed because it is too large Load diff

View file

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#ifndef AUDIO_DEVICE_AUDIO_DEVICE_IMPL_H_ #ifndef MODULES_AUDIO_DEVICE_AUDIO_DEVICE_IMPL_H_
#define AUDIO_DEVICE_AUDIO_DEVICE_IMPL_H_ #define MODULES_AUDIO_DEVICE_AUDIO_DEVICE_IMPL_H_
#if defined(WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE) #if defined(WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE)
@ -160,37 +160,33 @@ class AudioDeviceModuleImpl : public AudioDeviceModule {
int GetRecordAudioParameters(AudioParameters* params) const override; int GetRecordAudioParameters(AudioParameters* params) const override;
#endif // WEBRTC_IOS #endif // WEBRTC_IOS
int32_t Id() { return _id; } int32_t Id() const { return id_; }
#if defined(WEBRTC_ANDROID) #if defined(WEBRTC_ANDROID)
// Only use this acccessor for test purposes on Android. // Only use this acccessor for test purposes on Android.
AudioManager* GetAndroidAudioManagerForTest() { AudioManager* GetAndroidAudioManagerForTest() {
return _audioManagerAndroid.get(); return audio_manager_android_.get();
} }
#endif #endif
AudioDeviceBuffer* GetAudioDeviceBuffer() { return &_audioDeviceBuffer; } AudioDeviceBuffer* GetAudioDeviceBuffer() { return &audio_device_buffer_; }
private: private:
PlatformType Platform() const; PlatformType Platform() const;
AudioLayer PlatformAudioLayer() const; AudioLayer PlatformAudioLayer() const;
rtc::CriticalSection _critSect; const int32_t id_;
rtc::CriticalSection _critSectAudioCb; AudioLayer audio_layer_;
PlatformType platform_type_ = kPlatformNotSupported;
AudioDeviceGeneric* _ptrAudioDevice; bool initialized_ = false;
AudioDeviceBuffer _audioDeviceBuffer;
#if defined(WEBRTC_ANDROID) #if defined(WEBRTC_ANDROID)
std::unique_ptr<AudioManager> _audioManagerAndroid; // Should be declared first to ensure that it outlives other resources.
std::unique_ptr<AudioManager> audio_manager_android_;
#endif #endif
int32_t _id; AudioDeviceBuffer audio_device_buffer_;
AudioLayer _platformAudioLayer; std::unique_ptr<AudioDeviceGeneric> audio_device_;
PlatformType _platformType;
bool _initialized;
mutable ErrorCode _lastError;
}; };
} // namespace webrtc } // namespace webrtc
#endif // defined(WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE) #endif // defined(WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE)
#endif // MODULES_INTERFACE_AUDIO_DEVICE_IMPL_H_ #endif // MODULES_AUDIO_DEVICE_AUDIO_DEVICE_IMPL_H_