diff --git a/audio/aidl/default/Stream.cpp b/audio/aidl/default/Stream.cpp index c5b25d6047..7a617c9f9a 100644 --- a/audio/aidl/default/Stream.cpp +++ b/audio/aidl/default/Stream.cpp @@ -117,7 +117,7 @@ void StreamWorkerCommonLogic::populateReply(StreamDescriptor::Reply* reply, if (isConnected) { reply->observable.frames = mContext->getFrameCount(); reply->observable.timeNs = ::android::elapsedRealtimeNano(); - if (auto status = mDriver->getPosition(&reply->observable); status == ::android::OK) { + if (auto status = mDriver->refinePosition(&reply->observable); status == ::android::OK) { return; } } @@ -739,12 +739,12 @@ static std::map transformMicrophones( } // namespace StreamIn::StreamIn(StreamContext&& context, const std::vector& microphones) - : mContext(std::move(context)), mMicrophones(transformMicrophones(microphones)) { + : mContextInstance(std::move(context)), mMicrophones(transformMicrophones(microphones)) { LOG(DEBUG) << __func__; } void StreamIn::defaultOnClose() { - mContext.reset(); + mContextInstance.reset(); } ndk::ScopedAStatus StreamIn::getActiveMicrophones( @@ -800,12 +800,12 @@ ndk::ScopedAStatus StreamIn::setHwGain(const std::vector& in_channelGains } StreamOut::StreamOut(StreamContext&& context, const std::optional& offloadInfo) - : mContext(std::move(context)), mOffloadInfo(offloadInfo) { + : mContextInstance(std::move(context)), mOffloadInfo(offloadInfo) { LOG(DEBUG) << __func__; } void StreamOut::defaultOnClose() { - mContext.reset(); + mContextInstance.reset(); } ndk::ScopedAStatus StreamOut::updateOffloadMetadata( diff --git a/audio/aidl/default/alsa/StreamAlsa.cpp b/audio/aidl/default/alsa/StreamAlsa.cpp index 00a7a8426b..1d22a607e5 100644 --- a/audio/aidl/default/alsa/StreamAlsa.cpp +++ b/audio/aidl/default/alsa/StreamAlsa.cpp @@ -108,7 +108,7 @@ StreamAlsa::StreamAlsa(StreamContext* context, const Metadata& metadata, int rea return ::android::OK; } -::android::status_t StreamAlsa::getPosition(StreamDescriptor::Position* position) { +::android::status_t StreamAlsa::refinePosition(StreamDescriptor::Position* position) { if (mAlsaDeviceProxies.empty()) { LOG(FATAL) << __func__ << ": no input devices"; return ::android::NO_INIT; diff --git a/audio/aidl/default/bluetooth/StreamBluetooth.cpp b/audio/aidl/default/bluetooth/StreamBluetooth.cpp index 8cb93e3cea..91a33c2f5d 100644 --- a/audio/aidl/default/bluetooth/StreamBluetooth.cpp +++ b/audio/aidl/default/bluetooth/StreamBluetooth.cpp @@ -320,7 +320,7 @@ StreamInBluetooth::StreamInBluetooth(StreamContext&& context, const SinkMetadata const std::vector& microphones, Module::BtProfileHandles&& btProfileHandles) : StreamIn(std::move(context), microphones), - StreamBluetooth(&(StreamIn::mContext), sinkMetadata, std::move(btProfileHandles)) {} + StreamBluetooth(&mContextInstance, sinkMetadata, std::move(btProfileHandles)) {} ndk::ScopedAStatus StreamInBluetooth::getActiveMicrophones( std::vector* _aidl_return __unused) { @@ -333,6 +333,6 @@ StreamOutBluetooth::StreamOutBluetooth(StreamContext&& context, const std::optional& offloadInfo, Module::BtProfileHandles&& btProfileHandles) : StreamOut(std::move(context), offloadInfo), - StreamBluetooth(&(StreamOut::mContext), sourceMetadata, std::move(btProfileHandles)) {} + StreamBluetooth(&mContextInstance, sourceMetadata, std::move(btProfileHandles)) {} } // namespace aidl::android::hardware::audio::core diff --git a/audio/aidl/default/include/core-impl/Stream.h b/audio/aidl/default/include/core-impl/Stream.h index 1ba35200d0..a2edb6f937 100644 --- a/audio/aidl/default/include/core-impl/Stream.h +++ b/audio/aidl/default/include/core-impl/Stream.h @@ -195,10 +195,10 @@ struct DriverInterface { virtual ::android::status_t start() = 0; virtual ::android::status_t transfer(void* buffer, size_t frameCount, size_t* actualFrameCount, int32_t* latencyMs) = 0; - // No need to implement 'getPosition' unless the driver can provide more precise + // No need to implement 'refinePosition' unless the driver can provide more precise // data than just total frame count. For example, the driver may correctly account // for any intermediate buffers. - virtual ::android::status_t getPosition(StreamDescriptor::Position* /*position*/) { + virtual ::android::status_t refinePosition(StreamDescriptor::Position* /*position*/) { return ::android::OK; } virtual void shutdown() = 0; // This function is only called once. @@ -507,7 +507,7 @@ class StreamIn : virtual public StreamCommonInterface, public BnStreamIn { StreamIn(StreamContext&& context, const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones); - StreamContext mContext; + StreamContext mContextInstance; const std::map<::aidl::android::media::audio::common::AudioDevice, std::string> mMicrophones; }; @@ -552,7 +552,7 @@ class StreamOut : virtual public StreamCommonInterface, public BnStreamOut { const std::optional<::aidl::android::media::audio::common::AudioOffloadInfo>& offloadInfo); - StreamContext mContext; + StreamContext mContextInstance; const std::optional<::aidl::android::media::audio::common::AudioOffloadInfo> mOffloadInfo; std::optional<::aidl::android::hardware::audio::common::AudioOffloadMetadata> mOffloadMetadata; }; diff --git a/audio/aidl/default/include/core-impl/StreamAlsa.h b/audio/aidl/default/include/core-impl/StreamAlsa.h index f98a922a5f..555b27a772 100644 --- a/audio/aidl/default/include/core-impl/StreamAlsa.h +++ b/audio/aidl/default/include/core-impl/StreamAlsa.h @@ -41,7 +41,7 @@ class StreamAlsa : public StreamCommonImpl { ::android::status_t start() override; ::android::status_t transfer(void* buffer, size_t frameCount, size_t* actualFrameCount, int32_t* latencyMs) override; - ::android::status_t getPosition(StreamDescriptor::Position* position) override; + ::android::status_t refinePosition(StreamDescriptor::Position* position) override; void shutdown() override; protected: diff --git a/audio/aidl/default/include/core-impl/StreamRemoteSubmix.h b/audio/aidl/default/include/core-impl/StreamRemoteSubmix.h index 74854c6037..94404a1c7e 100644 --- a/audio/aidl/default/include/core-impl/StreamRemoteSubmix.h +++ b/audio/aidl/default/include/core-impl/StreamRemoteSubmix.h @@ -39,7 +39,7 @@ class StreamRemoteSubmix : public StreamCommonImpl { ::android::status_t start() override; ::android::status_t transfer(void* buffer, size_t frameCount, size_t* actualFrameCount, int32_t* latencyMs) override; - ::android::status_t getPosition(StreamDescriptor::Position* position) override; + ::android::status_t refinePosition(StreamDescriptor::Position* position) override; void shutdown() override; // Overridden methods of 'StreamCommonImpl', called on a Binder thread. diff --git a/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp b/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp index 12839add2d..11838f8d95 100644 --- a/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp +++ b/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp @@ -184,7 +184,7 @@ void StreamRemoteSubmix::shutdown() { : outWrite(buffer, frameCount, actualFrameCount)); } -::android::status_t StreamRemoteSubmix::getPosition(StreamDescriptor::Position* position) { +::android::status_t StreamRemoteSubmix::refinePosition(StreamDescriptor::Position* position) { sp source = mCurrentRoute->getSource(); if (source == nullptr) { return ::android::NO_INIT; @@ -363,8 +363,7 @@ size_t StreamRemoteSubmix::getStreamPipeSizeInFrames() { StreamInRemoteSubmix::StreamInRemoteSubmix(StreamContext&& context, const SinkMetadata& sinkMetadata, const std::vector& microphones) - : StreamIn(std::move(context), microphones), - StreamSwitcher(&(StreamIn::mContext), sinkMetadata) {} + : StreamIn(std::move(context), microphones), StreamSwitcher(&mContextInstance, sinkMetadata) {} ndk::ScopedAStatus StreamInRemoteSubmix::getActiveMicrophones( std::vector* _aidl_return) { @@ -405,7 +404,7 @@ StreamOutRemoteSubmix::StreamOutRemoteSubmix(StreamContext&& context, const SourceMetadata& sourceMetadata, const std::optional& offloadInfo) : StreamOut(std::move(context), offloadInfo), - StreamSwitcher(&(StreamOut::mContext), sourceMetadata) {} + StreamSwitcher(&mContextInstance, sourceMetadata) {} StreamSwitcher::DeviceSwitchBehavior StreamOutRemoteSubmix::switchCurrentStream( const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices) { diff --git a/audio/aidl/default/stub/StreamStub.cpp b/audio/aidl/default/stub/StreamStub.cpp index 66f46059a4..9b6a759c65 100644 --- a/audio/aidl/default/stub/StreamStub.cpp +++ b/audio/aidl/default/stub/StreamStub.cpp @@ -120,11 +120,10 @@ void StreamStub::shutdown() { StreamInStub::StreamInStub(StreamContext&& context, const SinkMetadata& sinkMetadata, const std::vector& microphones) - : StreamIn(std::move(context), microphones), StreamStub(&(StreamIn::mContext), sinkMetadata) {} + : StreamIn(std::move(context), microphones), StreamStub(&mContextInstance, sinkMetadata) {} StreamOutStub::StreamOutStub(StreamContext&& context, const SourceMetadata& sourceMetadata, const std::optional& offloadInfo) - : StreamOut(std::move(context), offloadInfo), - StreamStub(&(StreamOut::mContext), sourceMetadata) {} + : StreamOut(std::move(context), offloadInfo), StreamStub(&mContextInstance, sourceMetadata) {} } // namespace aidl::android::hardware::audio::core diff --git a/audio/aidl/default/usb/StreamUsb.cpp b/audio/aidl/default/usb/StreamUsb.cpp index 9684a871df..4efe0d8b42 100644 --- a/audio/aidl/default/usb/StreamUsb.cpp +++ b/audio/aidl/default/usb/StreamUsb.cpp @@ -85,7 +85,7 @@ std::vector StreamUsb::getDeviceProfiles() { StreamInUsb::StreamInUsb(StreamContext&& context, const SinkMetadata& sinkMetadata, const std::vector& microphones) - : StreamIn(std::move(context), microphones), StreamUsb(&(StreamIn::mContext), sinkMetadata) {} + : StreamIn(std::move(context), microphones), StreamUsb(&mContextInstance, sinkMetadata) {} ndk::ScopedAStatus StreamInUsb::getActiveMicrophones( std::vector* _aidl_return __unused) { @@ -96,7 +96,7 @@ ndk::ScopedAStatus StreamInUsb::getActiveMicrophones( StreamOutUsb::StreamOutUsb(StreamContext&& context, const SourceMetadata& sourceMetadata, const std::optional& offloadInfo) : StreamOut(std::move(context), offloadInfo), - StreamUsb(&(StreamOut::mContext), sourceMetadata), + StreamUsb(&mContextInstance, sourceMetadata), mChannelCount(getChannelCount(getContext().getChannelLayout())) {} ndk::ScopedAStatus StreamOutUsb::getHwVolume(std::vector* _aidl_return) {