Loading audio/aidl/default/EffectImpl.cpp +3 −0 Original line number Original line Diff line number Diff line Loading @@ -15,7 +15,9 @@ */ */ #include <memory> #include <memory> #define ATRACE_TAG ATRACE_TAG_AUDIO #define LOG_TAG "AHAL_EffectImpl" #define LOG_TAG "AHAL_EffectImpl" #include <utils/Trace.h> #include "effect-impl/EffectImpl.h" #include "effect-impl/EffectImpl.h" #include "effect-impl/EffectTypes.h" #include "effect-impl/EffectTypes.h" #include "include/effect-impl/EffectTypes.h" #include "include/effect-impl/EffectTypes.h" Loading Loading @@ -298,6 +300,7 @@ IEffect::Status EffectImpl::status(binder_status_t status, size_t consumed, size } } void EffectImpl::process() { void EffectImpl::process() { ATRACE_CALL(); /** /** * wait for the EventFlag without lock, it's ok because the mEfGroup pointer will not change * wait for the EventFlag without lock, it's ok because the mEfGroup pointer will not change * in the life cycle of workerThread (threadLoop). * in the life cycle of workerThread (threadLoop). Loading audio/aidl/default/Stream.cpp +5 −3 Original line number Original line Diff line number Diff line Loading @@ -16,14 +16,14 @@ #include <pthread.h> #include <pthread.h> #define ATRACE_TAG ATRACE_TAG_AUDIO #define LOG_TAG "AHAL_Stream" #define LOG_TAG "AHAL_Stream" #include <Utils.h> #include <android-base/logging.h> #include <android-base/logging.h> #include <android/binder_ibinder_platform.h> #include <android/binder_ibinder_platform.h> #include <utils/SystemClock.h> #include <utils/SystemClock.h> #include <utils/Trace.h> #include <Utils.h> #include "core-impl/Module.h" #include "core-impl/Stream.h" #include "core-impl/Stream.h" using aidl::android::hardware::audio::common::AudioOffloadMetadata; using aidl::android::hardware::audio::common::AudioOffloadMetadata; Loading Loading @@ -312,6 +312,7 @@ StreamInWorkerLogic::Status StreamInWorkerLogic::cycle() { } } bool StreamInWorkerLogic::read(size_t clientSize, StreamDescriptor::Reply* reply) { bool StreamInWorkerLogic::read(size_t clientSize, StreamDescriptor::Reply* reply) { ATRACE_CALL(); StreamContext::DataMQ* const dataMQ = mContext->getDataMQ(); StreamContext::DataMQ* const dataMQ = mContext->getDataMQ(); const size_t byteCount = std::min({clientSize, dataMQ->availableToWrite(), mDataBufferSize}); const size_t byteCount = std::min({clientSize, dataMQ->availableToWrite(), mDataBufferSize}); const bool isConnected = mIsConnected; const bool isConnected = mIsConnected; Loading Loading @@ -583,6 +584,7 @@ StreamOutWorkerLogic::Status StreamOutWorkerLogic::cycle() { } } bool StreamOutWorkerLogic::write(size_t clientSize, StreamDescriptor::Reply* reply) { bool StreamOutWorkerLogic::write(size_t clientSize, StreamDescriptor::Reply* reply) { ATRACE_CALL(); StreamContext::DataMQ* const dataMQ = mContext->getDataMQ(); StreamContext::DataMQ* const dataMQ = mContext->getDataMQ(); const size_t readByteCount = dataMQ->availableToRead(); const size_t readByteCount = dataMQ->availableToRead(); const size_t frameSize = mContext->getFrameSize(); const size_t frameSize = mContext->getFrameSize(); Loading audio/aidl/default/bluetooth/StreamBluetooth.cpp +6 −8 Original line number Original line Diff line number Diff line Loading @@ -16,12 +16,13 @@ #include <algorithm> #include <algorithm> #define ATRACE_TAG ATRACE_TAG_AUDIO #define LOG_TAG "AHAL_StreamBluetooth" #define LOG_TAG "AHAL_StreamBluetooth" #include <Utils.h> #include <Utils.h> #include <android-base/logging.h> #include <android-base/logging.h> #include <audio_utils/clock.h> #include <audio_utils/clock.h> #include <utils/Trace.h> #include "BluetoothAudioSession.h" #include "core-impl/StreamBluetooth.h" #include "core-impl/StreamBluetooth.h" using aidl::android::hardware::audio::common::frameCountFromDurationUs; using aidl::android::hardware::audio::common::frameCountFromDurationUs; Loading Loading @@ -109,13 +110,10 @@ StreamBluetooth::StreamBluetooth(StreamContext* context, const Metadata& metadat } } const size_t fc = std::min(frameCount, mPreferredFrameCount); const size_t fc = std::min(frameCount, mPreferredFrameCount); const size_t bytesToTransfer = fc * mFrameSizeBytes; const size_t bytesToTransfer = fc * mFrameSizeBytes; if (mIsInput) { const size_t bytesTransferred = mIsInput ? mBtDeviceProxy->readData(buffer, bytesToTransfer) const size_t totalRead = mBtDeviceProxy->readData(buffer, bytesToTransfer); : mBtDeviceProxy->writeData(buffer, bytesToTransfer); *actualFrameCount = std::max(*actualFrameCount, totalRead / mFrameSizeBytes); *actualFrameCount = bytesTransferred / mFrameSizeBytes; } else { ATRACE_INT("BTdropped", bytesToTransfer - bytesTransferred); const size_t totalWrite = mBtDeviceProxy->writeData(buffer, bytesToTransfer); *actualFrameCount = std::max(*actualFrameCount, totalWrite / mFrameSizeBytes); } PresentationPosition presentation_position; PresentationPosition presentation_position; if (!mBtDeviceProxy->getPresentationPosition(presentation_position)) { if (!mBtDeviceProxy->getPresentationPosition(presentation_position)) { presentation_position.remoteDeviceAudioDelayNanos = presentation_position.remoteDeviceAudioDelayNanos = Loading Loading
audio/aidl/default/EffectImpl.cpp +3 −0 Original line number Original line Diff line number Diff line Loading @@ -15,7 +15,9 @@ */ */ #include <memory> #include <memory> #define ATRACE_TAG ATRACE_TAG_AUDIO #define LOG_TAG "AHAL_EffectImpl" #define LOG_TAG "AHAL_EffectImpl" #include <utils/Trace.h> #include "effect-impl/EffectImpl.h" #include "effect-impl/EffectImpl.h" #include "effect-impl/EffectTypes.h" #include "effect-impl/EffectTypes.h" #include "include/effect-impl/EffectTypes.h" #include "include/effect-impl/EffectTypes.h" Loading Loading @@ -298,6 +300,7 @@ IEffect::Status EffectImpl::status(binder_status_t status, size_t consumed, size } } void EffectImpl::process() { void EffectImpl::process() { ATRACE_CALL(); /** /** * wait for the EventFlag without lock, it's ok because the mEfGroup pointer will not change * wait for the EventFlag without lock, it's ok because the mEfGroup pointer will not change * in the life cycle of workerThread (threadLoop). * in the life cycle of workerThread (threadLoop). Loading
audio/aidl/default/Stream.cpp +5 −3 Original line number Original line Diff line number Diff line Loading @@ -16,14 +16,14 @@ #include <pthread.h> #include <pthread.h> #define ATRACE_TAG ATRACE_TAG_AUDIO #define LOG_TAG "AHAL_Stream" #define LOG_TAG "AHAL_Stream" #include <Utils.h> #include <android-base/logging.h> #include <android-base/logging.h> #include <android/binder_ibinder_platform.h> #include <android/binder_ibinder_platform.h> #include <utils/SystemClock.h> #include <utils/SystemClock.h> #include <utils/Trace.h> #include <Utils.h> #include "core-impl/Module.h" #include "core-impl/Stream.h" #include "core-impl/Stream.h" using aidl::android::hardware::audio::common::AudioOffloadMetadata; using aidl::android::hardware::audio::common::AudioOffloadMetadata; Loading Loading @@ -312,6 +312,7 @@ StreamInWorkerLogic::Status StreamInWorkerLogic::cycle() { } } bool StreamInWorkerLogic::read(size_t clientSize, StreamDescriptor::Reply* reply) { bool StreamInWorkerLogic::read(size_t clientSize, StreamDescriptor::Reply* reply) { ATRACE_CALL(); StreamContext::DataMQ* const dataMQ = mContext->getDataMQ(); StreamContext::DataMQ* const dataMQ = mContext->getDataMQ(); const size_t byteCount = std::min({clientSize, dataMQ->availableToWrite(), mDataBufferSize}); const size_t byteCount = std::min({clientSize, dataMQ->availableToWrite(), mDataBufferSize}); const bool isConnected = mIsConnected; const bool isConnected = mIsConnected; Loading Loading @@ -583,6 +584,7 @@ StreamOutWorkerLogic::Status StreamOutWorkerLogic::cycle() { } } bool StreamOutWorkerLogic::write(size_t clientSize, StreamDescriptor::Reply* reply) { bool StreamOutWorkerLogic::write(size_t clientSize, StreamDescriptor::Reply* reply) { ATRACE_CALL(); StreamContext::DataMQ* const dataMQ = mContext->getDataMQ(); StreamContext::DataMQ* const dataMQ = mContext->getDataMQ(); const size_t readByteCount = dataMQ->availableToRead(); const size_t readByteCount = dataMQ->availableToRead(); const size_t frameSize = mContext->getFrameSize(); const size_t frameSize = mContext->getFrameSize(); Loading
audio/aidl/default/bluetooth/StreamBluetooth.cpp +6 −8 Original line number Original line Diff line number Diff line Loading @@ -16,12 +16,13 @@ #include <algorithm> #include <algorithm> #define ATRACE_TAG ATRACE_TAG_AUDIO #define LOG_TAG "AHAL_StreamBluetooth" #define LOG_TAG "AHAL_StreamBluetooth" #include <Utils.h> #include <Utils.h> #include <android-base/logging.h> #include <android-base/logging.h> #include <audio_utils/clock.h> #include <audio_utils/clock.h> #include <utils/Trace.h> #include "BluetoothAudioSession.h" #include "core-impl/StreamBluetooth.h" #include "core-impl/StreamBluetooth.h" using aidl::android::hardware::audio::common::frameCountFromDurationUs; using aidl::android::hardware::audio::common::frameCountFromDurationUs; Loading Loading @@ -109,13 +110,10 @@ StreamBluetooth::StreamBluetooth(StreamContext* context, const Metadata& metadat } } const size_t fc = std::min(frameCount, mPreferredFrameCount); const size_t fc = std::min(frameCount, mPreferredFrameCount); const size_t bytesToTransfer = fc * mFrameSizeBytes; const size_t bytesToTransfer = fc * mFrameSizeBytes; if (mIsInput) { const size_t bytesTransferred = mIsInput ? mBtDeviceProxy->readData(buffer, bytesToTransfer) const size_t totalRead = mBtDeviceProxy->readData(buffer, bytesToTransfer); : mBtDeviceProxy->writeData(buffer, bytesToTransfer); *actualFrameCount = std::max(*actualFrameCount, totalRead / mFrameSizeBytes); *actualFrameCount = bytesTransferred / mFrameSizeBytes; } else { ATRACE_INT("BTdropped", bytesToTransfer - bytesTransferred); const size_t totalWrite = mBtDeviceProxy->writeData(buffer, bytesToTransfer); *actualFrameCount = std::max(*actualFrameCount, totalWrite / mFrameSizeBytes); } PresentationPosition presentation_position; PresentationPosition presentation_position; if (!mBtDeviceProxy->getPresentationPosition(presentation_position)) { if (!mBtDeviceProxy->getPresentationPosition(presentation_position)) { presentation_position.remoteDeviceAudioDelayNanos = presentation_position.remoteDeviceAudioDelayNanos = Loading