Loading services/oboeservice/AAudioServiceEndpoint.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,10 @@ using namespace android; // TODO just import names needed using namespace aaudio; // TODO just import names needed AAudioServiceEndpoint::~AAudioServiceEndpoint() { ALOGD("%s() called", __func__); } std::string AAudioServiceEndpoint::dump() const NO_THREAD_SAFETY_ANALYSIS { std::stringstream result; Loading services/oboeservice/AAudioServiceEndpoint.h +1 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ class AAudioServiceEndpoint , public AAudioStreamParameters { public: virtual ~AAudioServiceEndpoint() = default; virtual ~AAudioServiceEndpoint(); virtual std::string dump() const; Loading services/oboeservice/AAudioServiceEndpointMMAP.cpp +9 −6 Original line number Diff line number Diff line Loading @@ -51,8 +51,6 @@ AAudioServiceEndpointMMAP::AAudioServiceEndpointMMAP(AAudioService &audioService : mMmapStream(nullptr) , mAAudioService(audioService) {} AAudioServiceEndpointMMAP::~AAudioServiceEndpointMMAP() {} std::string AAudioServiceEndpointMMAP::dump() const { std::stringstream result; Loading Loading @@ -357,7 +355,10 @@ void AAudioServiceEndpointMMAP::handleTearDownAsync(audio_port_handle_t portHand // This is called by AudioFlinger when it wants to destroy a stream. void AAudioServiceEndpointMMAP::onTearDown(audio_port_handle_t portHandle) { ALOGD("%s(portHandle = %d) called", __func__, portHandle); std::thread asyncTask(&AAudioServiceEndpointMMAP::handleTearDownAsync, this, portHandle); android::sp<AAudioServiceEndpointMMAP> holdEndpoint(this); std::thread asyncTask([holdEndpoint, portHandle]() { holdEndpoint->handleTearDownAsync(portHandle); }); asyncTask.detach(); } Loading @@ -378,9 +379,11 @@ void AAudioServiceEndpointMMAP::onRoutingChanged(audio_port_handle_t portHandle) ALOGD("%s() called with dev %d, old = %d", __func__, deviceId, getDeviceId()); if (getDeviceId() != deviceId) { if (getDeviceId() != AUDIO_PORT_HANDLE_NONE) { std::thread asyncTask([this, deviceId]() { disconnectRegisteredStreams(); setDeviceId(deviceId); android::sp<AAudioServiceEndpointMMAP> holdEndpoint(this); std::thread asyncTask([holdEndpoint, deviceId]() { ALOGD("onRoutingChanged() asyncTask launched"); holdEndpoint->disconnectRegisteredStreams(); holdEndpoint->setDeviceId(deviceId); }); asyncTask.detach(); } else { Loading services/oboeservice/AAudioServiceEndpointMMAP.h +1 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ class AAudioServiceEndpointMMAP public: explicit AAudioServiceEndpointMMAP(android::AAudioService &audioService); virtual ~AAudioServiceEndpointMMAP(); virtual ~AAudioServiceEndpointMMAP() = default; std::string dump() const override; Loading services/oboeservice/AAudioServiceStreamBase.cpp +12 −1 Original line number Diff line number Diff line Loading @@ -261,8 +261,14 @@ aaudio_result_t AAudioServiceStreamBase::start() { sendServiceEvent(AAUDIO_SERVICE_EVENT_STARTED); setState(AAUDIO_STREAM_STATE_STARTED); mThreadEnabled.store(true); // Make sure this object does not get deleted before the run() method // can protect it by making a strong pointer. incStrong(nullptr); // See run() method. result = mTimestampThread.start(this); if (result != AAUDIO_OK) goto error; if (result != AAUDIO_OK) { decStrong(nullptr); // run() can't do it so we have to do it here. goto error; } return result; Loading Loading @@ -396,7 +402,12 @@ aaudio_result_t AAudioServiceStreamBase::flush() { __attribute__((no_sanitize("integer"))) void AAudioServiceStreamBase::run() { ALOGD("%s() %s entering >>>>>>>>>>>>>> TIMESTAMPS", __func__, getTypeText()); // Hold onto the ref counted stream until the end. android::sp<AAudioServiceStreamBase> holdStream(this); TimestampScheduler timestampScheduler; // Balance the incStrong from when the thread was launched. holdStream->decStrong(nullptr); timestampScheduler.setBurstPeriod(mFramesPerBurst, getSampleRate()); timestampScheduler.start(AudioClock::getNanoseconds()); int64_t nextTime = timestampScheduler.nextAbsoluteTime(); Loading Loading
services/oboeservice/AAudioServiceEndpoint.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,10 @@ using namespace android; // TODO just import names needed using namespace aaudio; // TODO just import names needed AAudioServiceEndpoint::~AAudioServiceEndpoint() { ALOGD("%s() called", __func__); } std::string AAudioServiceEndpoint::dump() const NO_THREAD_SAFETY_ANALYSIS { std::stringstream result; Loading
services/oboeservice/AAudioServiceEndpoint.h +1 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ class AAudioServiceEndpoint , public AAudioStreamParameters { public: virtual ~AAudioServiceEndpoint() = default; virtual ~AAudioServiceEndpoint(); virtual std::string dump() const; Loading
services/oboeservice/AAudioServiceEndpointMMAP.cpp +9 −6 Original line number Diff line number Diff line Loading @@ -51,8 +51,6 @@ AAudioServiceEndpointMMAP::AAudioServiceEndpointMMAP(AAudioService &audioService : mMmapStream(nullptr) , mAAudioService(audioService) {} AAudioServiceEndpointMMAP::~AAudioServiceEndpointMMAP() {} std::string AAudioServiceEndpointMMAP::dump() const { std::stringstream result; Loading Loading @@ -357,7 +355,10 @@ void AAudioServiceEndpointMMAP::handleTearDownAsync(audio_port_handle_t portHand // This is called by AudioFlinger when it wants to destroy a stream. void AAudioServiceEndpointMMAP::onTearDown(audio_port_handle_t portHandle) { ALOGD("%s(portHandle = %d) called", __func__, portHandle); std::thread asyncTask(&AAudioServiceEndpointMMAP::handleTearDownAsync, this, portHandle); android::sp<AAudioServiceEndpointMMAP> holdEndpoint(this); std::thread asyncTask([holdEndpoint, portHandle]() { holdEndpoint->handleTearDownAsync(portHandle); }); asyncTask.detach(); } Loading @@ -378,9 +379,11 @@ void AAudioServiceEndpointMMAP::onRoutingChanged(audio_port_handle_t portHandle) ALOGD("%s() called with dev %d, old = %d", __func__, deviceId, getDeviceId()); if (getDeviceId() != deviceId) { if (getDeviceId() != AUDIO_PORT_HANDLE_NONE) { std::thread asyncTask([this, deviceId]() { disconnectRegisteredStreams(); setDeviceId(deviceId); android::sp<AAudioServiceEndpointMMAP> holdEndpoint(this); std::thread asyncTask([holdEndpoint, deviceId]() { ALOGD("onRoutingChanged() asyncTask launched"); holdEndpoint->disconnectRegisteredStreams(); holdEndpoint->setDeviceId(deviceId); }); asyncTask.detach(); } else { Loading
services/oboeservice/AAudioServiceEndpointMMAP.h +1 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ class AAudioServiceEndpointMMAP public: explicit AAudioServiceEndpointMMAP(android::AAudioService &audioService); virtual ~AAudioServiceEndpointMMAP(); virtual ~AAudioServiceEndpointMMAP() = default; std::string dump() const override; Loading
services/oboeservice/AAudioServiceStreamBase.cpp +12 −1 Original line number Diff line number Diff line Loading @@ -261,8 +261,14 @@ aaudio_result_t AAudioServiceStreamBase::start() { sendServiceEvent(AAUDIO_SERVICE_EVENT_STARTED); setState(AAUDIO_STREAM_STATE_STARTED); mThreadEnabled.store(true); // Make sure this object does not get deleted before the run() method // can protect it by making a strong pointer. incStrong(nullptr); // See run() method. result = mTimestampThread.start(this); if (result != AAUDIO_OK) goto error; if (result != AAUDIO_OK) { decStrong(nullptr); // run() can't do it so we have to do it here. goto error; } return result; Loading Loading @@ -396,7 +402,12 @@ aaudio_result_t AAudioServiceStreamBase::flush() { __attribute__((no_sanitize("integer"))) void AAudioServiceStreamBase::run() { ALOGD("%s() %s entering >>>>>>>>>>>>>> TIMESTAMPS", __func__, getTypeText()); // Hold onto the ref counted stream until the end. android::sp<AAudioServiceStreamBase> holdStream(this); TimestampScheduler timestampScheduler; // Balance the incStrong from when the thread was launched. holdStream->decStrong(nullptr); timestampScheduler.setBurstPeriod(mFramesPerBurst, getSampleRate()); timestampScheduler.start(AudioClock::getNanoseconds()); int64_t nextTime = timestampScheduler.nextAbsoluteTime(); Loading