Loading media/libaudioclient/AudioTrack.cpp +18 −2 Original line number Diff line number Diff line Loading @@ -2248,6 +2248,16 @@ status_t AudioTrack::restoreTrack_l(const char *from) staticPosition = mStaticProxy->getPosition().unsignedValue(); } // See b/74409267. Connecting to a BT A2DP device supporting multiple codecs // causes a lot of churn on the service side, and it can reject starting // playback of a previously created track. May also apply to other cases. const int INITIAL_RETRIES = 3; int retries = INITIAL_RETRIES; retry: if (retries < INITIAL_RETRIES) { // See the comment for clearAudioConfigCache at the start of the function. AudioSystem::clearAudioConfigCache(); } mFlags = mOrigFlags; // If a new IAudioTrack is successfully created, createTrack_l() will modify the Loading @@ -2256,7 +2266,10 @@ status_t AudioTrack::restoreTrack_l(const char *from) // If a new IAudioTrack cannot be created, the previous (dead) instance will be left intact. status_t result = createTrack_l(); if (result == NO_ERROR) { if (result != NO_ERROR) { ALOGW("%s(): createTrack_l failed, do not retry", __func__); retries = 0; } else { // take the frames that will be lost by track recreation into account in saved position // For streaming tracks, this is the amount we obtained from the user/client // (not the number actually consumed at the server - those are already lost). Loading Loading @@ -2301,7 +2314,10 @@ status_t AudioTrack::restoreTrack_l(const char *from) mFramesWrittenAtRestore = mFramesWrittenServerOffset; } if (result != NO_ERROR) { ALOGW("restoreTrack_l() failed status %d", result); ALOGW("%s() failed status %d, retries %d", __func__, result, retries); if (--retries > 0) { goto retry; } mState = STATE_STOPPED; mReleased = 0; } Loading media/libaudioclient/IAudioFlinger.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ enum { GET_AUDIO_HW_SYNC_FOR_SESSION, SYSTEM_READY, FRAME_COUNT_HAL, LIST_MICROPHONES, GET_MICROPHONES, }; #define MAX_ITEMS_PER_LIST 1024 Loading Loading @@ -849,7 +849,7 @@ public: { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); status_t status = remote()->transact(LIST_MICROPHONES, data, &reply); status_t status = remote()->transact(GET_MICROPHONES, data, &reply); if (status != NO_ERROR || (status = (status_t)reply.readInt32()) != NO_ERROR) { return status; Loading Loading @@ -1444,7 +1444,7 @@ status_t BnAudioFlinger::onTransact( reply->writeInt64( frameCountHAL((audio_io_handle_t) data.readInt32()) ); return NO_ERROR; } break; case LIST_MICROPHONES: { case GET_MICROPHONES: { CHECK_INTERFACE(IAudioFlinger, data, reply); std::vector<media::MicrophoneInfo> microphones; status_t status = getMicrophones(µphones); Loading media/libaudiohal/2.0/DeviceHalHidl.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ status_t deviceAddressFromHal( audio_devices_t device, const char* halAddress, DeviceAddress* address) { address->device = AudioDevice(device); if (address == nullptr || strnlen(halAddress, AUDIO_DEVICE_MAX_ADDRESS_LEN) == 0) { if (halAddress == nullptr || strnlen(halAddress, AUDIO_DEVICE_MAX_ADDRESS_LEN) == 0) { return OK; } const bool isInput = (device & AUDIO_DEVICE_BIT_IN) != 0; Loading Loading @@ -346,6 +346,12 @@ status_t DeviceHalHidl::setAudioPortConfig(const struct audio_port_config *confi return processReturn("setAudioPortConfig", mDevice->setAudioPortConfig(hidlConfig)); } status_t DeviceHalHidl::getMicrophones( std::vector<media::MicrophoneInfo> *microphonesInfo __unused) { if (mDevice == 0) return NO_INIT; return INVALID_OPERATION; } status_t DeviceHalHidl::dump(int fd) { if (mDevice == 0) return NO_INIT; native_handle_t* hidlHandle = native_handle_create(1, 0); Loading media/libaudiohal/2.0/DeviceHalHidl.h +3 −0 Original line number Diff line number Diff line Loading @@ -107,6 +107,9 @@ class DeviceHalHidl : public DeviceHalInterface, public ConversionHelperHidl // Set audio port configuration. virtual status_t setAudioPortConfig(const struct audio_port_config *config); // List microphones virtual status_t getMicrophones(std::vector<media::MicrophoneInfo> *microphones); virtual status_t dump(int fd); private: Loading media/libaudiohal/2.0/DeviceHalLocal.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -184,6 +184,11 @@ status_t DeviceHalLocal::setAudioPortConfig(const struct audio_port_config *conf return INVALID_OPERATION; } status_t DeviceHalLocal::getMicrophones( std::vector<media::MicrophoneInfo> *microphones __unused) { return INVALID_OPERATION; } status_t DeviceHalLocal::dump(int fd) { return mDev->dump(mDev, fd); } Loading Loading
media/libaudioclient/AudioTrack.cpp +18 −2 Original line number Diff line number Diff line Loading @@ -2248,6 +2248,16 @@ status_t AudioTrack::restoreTrack_l(const char *from) staticPosition = mStaticProxy->getPosition().unsignedValue(); } // See b/74409267. Connecting to a BT A2DP device supporting multiple codecs // causes a lot of churn on the service side, and it can reject starting // playback of a previously created track. May also apply to other cases. const int INITIAL_RETRIES = 3; int retries = INITIAL_RETRIES; retry: if (retries < INITIAL_RETRIES) { // See the comment for clearAudioConfigCache at the start of the function. AudioSystem::clearAudioConfigCache(); } mFlags = mOrigFlags; // If a new IAudioTrack is successfully created, createTrack_l() will modify the Loading @@ -2256,7 +2266,10 @@ status_t AudioTrack::restoreTrack_l(const char *from) // If a new IAudioTrack cannot be created, the previous (dead) instance will be left intact. status_t result = createTrack_l(); if (result == NO_ERROR) { if (result != NO_ERROR) { ALOGW("%s(): createTrack_l failed, do not retry", __func__); retries = 0; } else { // take the frames that will be lost by track recreation into account in saved position // For streaming tracks, this is the amount we obtained from the user/client // (not the number actually consumed at the server - those are already lost). Loading Loading @@ -2301,7 +2314,10 @@ status_t AudioTrack::restoreTrack_l(const char *from) mFramesWrittenAtRestore = mFramesWrittenServerOffset; } if (result != NO_ERROR) { ALOGW("restoreTrack_l() failed status %d", result); ALOGW("%s() failed status %d, retries %d", __func__, result, retries); if (--retries > 0) { goto retry; } mState = STATE_STOPPED; mReleased = 0; } Loading
media/libaudioclient/IAudioFlinger.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ enum { GET_AUDIO_HW_SYNC_FOR_SESSION, SYSTEM_READY, FRAME_COUNT_HAL, LIST_MICROPHONES, GET_MICROPHONES, }; #define MAX_ITEMS_PER_LIST 1024 Loading Loading @@ -849,7 +849,7 @@ public: { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); status_t status = remote()->transact(LIST_MICROPHONES, data, &reply); status_t status = remote()->transact(GET_MICROPHONES, data, &reply); if (status != NO_ERROR || (status = (status_t)reply.readInt32()) != NO_ERROR) { return status; Loading Loading @@ -1444,7 +1444,7 @@ status_t BnAudioFlinger::onTransact( reply->writeInt64( frameCountHAL((audio_io_handle_t) data.readInt32()) ); return NO_ERROR; } break; case LIST_MICROPHONES: { case GET_MICROPHONES: { CHECK_INTERFACE(IAudioFlinger, data, reply); std::vector<media::MicrophoneInfo> microphones; status_t status = getMicrophones(µphones); Loading
media/libaudiohal/2.0/DeviceHalHidl.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ status_t deviceAddressFromHal( audio_devices_t device, const char* halAddress, DeviceAddress* address) { address->device = AudioDevice(device); if (address == nullptr || strnlen(halAddress, AUDIO_DEVICE_MAX_ADDRESS_LEN) == 0) { if (halAddress == nullptr || strnlen(halAddress, AUDIO_DEVICE_MAX_ADDRESS_LEN) == 0) { return OK; } const bool isInput = (device & AUDIO_DEVICE_BIT_IN) != 0; Loading Loading @@ -346,6 +346,12 @@ status_t DeviceHalHidl::setAudioPortConfig(const struct audio_port_config *confi return processReturn("setAudioPortConfig", mDevice->setAudioPortConfig(hidlConfig)); } status_t DeviceHalHidl::getMicrophones( std::vector<media::MicrophoneInfo> *microphonesInfo __unused) { if (mDevice == 0) return NO_INIT; return INVALID_OPERATION; } status_t DeviceHalHidl::dump(int fd) { if (mDevice == 0) return NO_INIT; native_handle_t* hidlHandle = native_handle_create(1, 0); Loading
media/libaudiohal/2.0/DeviceHalHidl.h +3 −0 Original line number Diff line number Diff line Loading @@ -107,6 +107,9 @@ class DeviceHalHidl : public DeviceHalInterface, public ConversionHelperHidl // Set audio port configuration. virtual status_t setAudioPortConfig(const struct audio_port_config *config); // List microphones virtual status_t getMicrophones(std::vector<media::MicrophoneInfo> *microphones); virtual status_t dump(int fd); private: Loading
media/libaudiohal/2.0/DeviceHalLocal.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -184,6 +184,11 @@ status_t DeviceHalLocal::setAudioPortConfig(const struct audio_port_config *conf return INVALID_OPERATION; } status_t DeviceHalLocal::getMicrophones( std::vector<media::MicrophoneInfo> *microphones __unused) { return INVALID_OPERATION; } status_t DeviceHalLocal::dump(int fd) { return mDev->dump(mDev, fd); } Loading