summaryrefslogtreecommitdiff
path: root/audio/core/all-versions/default/StreamOut.cpp
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2021-08-17 18:14:12 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2021-08-17 18:14:12 +0000
commitc541e8abb62a9a888de1cf48bbded105f7869cc0 (patch)
tree8a9c3f56607bb90577557ddd3261d36ae2ec2b93 /audio/core/all-versions/default/StreamOut.cpp
parent1aa8cad8558884c9dd0293dffbf823e45614a25d (diff)
parente287df40b90fe64c226f90c66353a33e8ef40063 (diff)
Merge "Merge sc-dev-plus-aosp-without-vendor@7634622" into stage-aosp-master
Diffstat (limited to 'audio/core/all-versions/default/StreamOut.cpp')
-rw-r--r--audio/core/all-versions/default/StreamOut.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/audio/core/all-versions/default/StreamOut.cpp b/audio/core/all-versions/default/StreamOut.cpp
index c23922dbb6..d027231f11 100644
--- a/audio/core/all-versions/default/StreamOut.cpp
+++ b/audio/core/all-versions/default/StreamOut.cpp
@@ -164,7 +164,7 @@ StreamOut::~StreamOut() {
status_t status = EventFlag::deleteEventFlag(&mEfGroup);
ALOGE_IF(status, "write MQ event flag deletion error: %s", strerror(-status));
}
- mCallback.clear();
+ mCallback = nullptr;
#if MAJOR_VERSION <= 5
mDevice->closeOutputStream(mStream);
// Closing the output stream in the HAL waits for the callback to finish,
@@ -398,9 +398,9 @@ Return<void> StreamOut::prepareForWriting(uint32_t frameSize, uint32_t framesCou
}
// Create and launch the thread.
- sp<WriteThread> tempWriteThread =
- new WriteThread(&mStopWriteThread, mStream, tempCommandMQ.get(), tempDataMQ.get(),
- tempStatusMQ.get(), tempElfGroup.get());
+ auto tempWriteThread =
+ sp<WriteThread>::make(&mStopWriteThread, mStream, tempCommandMQ.get(), tempDataMQ.get(),
+ tempStatusMQ.get(), tempElfGroup.get());
if (!tempWriteThread->init()) {
ALOGW("failed to start writer thread: %s", strerror(-status));
sendError(Result::INVALID_ARGUMENTS);
@@ -463,7 +463,7 @@ Return<Result> StreamOut::setCallback(const sp<IStreamOutCallback>& callback) {
Return<Result> StreamOut::clearCallback() {
if (mStream->set_callback == NULL) return Result::NOT_SUPPORTED;
- mCallback.clear();
+ mCallback = nullptr;
return Result::OK;
}
@@ -478,7 +478,7 @@ int StreamOut::asyncCallback(stream_callback_event_t event, void*, void* cookie)
// It's correct to hold an sp<> to callback because the reference
// in the StreamOut instance can be cleared in the meantime. There is
// no difference on which thread to run IStreamOutCallback's destructor.
- sp<IStreamOutCallback> callback = self->mCallback;
+ sp<IStreamOutCallback> callback = self->mCallback.load();
if (callback.get() == nullptr) return 0;
ALOGV("asyncCallback() event %d", event);
Return<void> result;
@@ -736,7 +736,7 @@ Return<Result> StreamOut::setEventCallback(const sp<IStreamOutEventCallback>& ca
// static
int StreamOut::asyncEventCallback(stream_event_callback_type_t event, void* param, void* cookie) {
StreamOut* self = reinterpret_cast<StreamOut*>(cookie);
- sp<IStreamOutEventCallback> eventCallback = self->mEventCallback;
+ sp<IStreamOutEventCallback> eventCallback = self->mEventCallback.load();
if (eventCallback.get() == nullptr) return 0;
ALOGV("%s event %d", __func__, event);
Return<void> result;