In android aaudio wrappers use threads through TaskQueue interface
Bug: webrtc:9702 Change-Id: I4686b8312a5e6705050ec89381938ea5da379d9b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/274160 Reviewed-by: Henrik Andreassson <henrika@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/main@{#38010}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
dd1eb2e1ec
commit
fbfd81f61a
@ -16,10 +16,9 @@
|
||||
#include <memory>
|
||||
|
||||
#include "api/sequence_checker.h"
|
||||
#include "api/task_queue/task_queue_base.h"
|
||||
#include "modules/audio_device/android/aaudio_wrapper.h"
|
||||
#include "modules/audio_device/include/audio_device_defines.h"
|
||||
#include "rtc_base/message_handler.h"
|
||||
#include "rtc_base/thread.h"
|
||||
#include "rtc_base/thread_annotations.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -48,8 +47,7 @@ class AudioManager;
|
||||
// where the internal AAudio buffer can be increased when needed. It will
|
||||
// reduce the risk of underruns (~glitches) at the expense of an increased
|
||||
// latency.
|
||||
class AAudioPlayer final : public AAudioObserverInterface,
|
||||
public rtc::MessageHandler {
|
||||
class AAudioPlayer final : public AAudioObserverInterface {
|
||||
public:
|
||||
explicit AAudioPlayer(AudioManager* audio_manager);
|
||||
~AAudioPlayer();
|
||||
@ -85,10 +83,6 @@ class AAudioPlayer final : public AAudioObserverInterface,
|
||||
// Called on a real-time thread owned by AAudio.
|
||||
void OnErrorCallback(aaudio_result_t error) override;
|
||||
|
||||
// rtc::MessageHandler used for restart messages from the error-callback
|
||||
// thread to the main (creating) thread.
|
||||
void OnMessage(rtc::Message* msg) override;
|
||||
|
||||
private:
|
||||
// Closes the existing stream and starts a new stream.
|
||||
void HandleStreamDisconnected();
|
||||
@ -102,8 +96,8 @@ class AAudioPlayer final : public AAudioObserverInterface,
|
||||
// object.
|
||||
SequenceChecker thread_checker_aaudio_;
|
||||
|
||||
// The thread on which this object is created on.
|
||||
rtc::Thread* main_thread_;
|
||||
// The task queue on which this object is created on.
|
||||
TaskQueueBase* main_thread_;
|
||||
|
||||
// Wraps all AAudio resources. Contains an output stream using the default
|
||||
// output audio device. Can be accessed on both the main thread and the
|
||||
|
||||
Reference in New Issue
Block a user