Loading media/libaaudio/src/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ cc_library { shared_libs: [ "libaudioclient", "libaudioutils", "liblog", "libcutils", "libutils", Loading media/libaaudio/src/client/AudioStreamInternal.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ aaudio_result_t AudioStreamInternal::open(const AudioStreamBuilder &builder) { setInputPreset(configurationOutput.getInputPreset()); // Save device format so we can do format conversion and volume scaling together. mDeviceFormat = configurationOutput.getFormat(); setDeviceFormat(configurationOutput.getFormat()); result = mServiceInterface.getStreamDescription(mServiceStreamHandle, mEndPointParcelable); if (result != AAUDIO_OK) { Loading media/libaaudio/src/client/AudioStreamInternal.h +0 −5 Original line number Diff line number Diff line Loading @@ -138,8 +138,6 @@ protected: // Calculate timeout for an operation involving framesPerOperation. int64_t calculateReasonableTimeout(int32_t framesPerOperation); aaudio_format_t getDeviceFormat() const { return mDeviceFormat; } int32_t getDeviceChannelCount() const { return mDeviceChannelCount; } /** Loading Loading @@ -195,9 +193,6 @@ private: int64_t mServiceLatencyNanos = 0; // Sometimes the hardware is operating with a different format or channel count from the app. // Then we require conversion in AAudio. aaudio_format_t mDeviceFormat = AAUDIO_FORMAT_UNSPECIFIED; int32_t mDeviceChannelCount = 0; }; Loading media/libaaudio/src/core/AudioStream.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -367,7 +367,6 @@ aaudio_result_t AudioStream::joinThread(void** returnArg, int64_t timeoutNanosec return err ? AAudioConvert_androidToAAudioResult(-errno) : mThreadRegistrationResult; } aaudio_data_callback_result_t AudioStream::maybeCallDataCallback(void *audioData, int32_t numFrames) { aaudio_data_callback_result_t result = AAUDIO_CALLBACK_RESULT_STOP; Loading media/libaaudio/src/core/AudioStream.h +44 −1 Original line number Diff line number Diff line Loading @@ -252,6 +252,20 @@ public: return AAudioConvert_formatToSizeInBytes(mFormat); } /** * This is only valid after setSamplesPerFrame() and setDeviceFormat() have been called. */ int32_t getBytesPerDeviceFrame() const { return mSamplesPerFrame * getBytesPerDeviceSample(); } /** * This is only valid after setDeviceFormat() has been called. */ int32_t getBytesPerDeviceSample() const { return AAudioConvert_formatToSizeInBytes(getDeviceFormat()); } virtual int64_t getFramesWritten() = 0; virtual int64_t getFramesRead() = 0; Loading Loading @@ -471,6 +485,17 @@ protected: mFormat = format; } /** * This should not be called after the open() call. */ void setDeviceFormat(aaudio_format_t format) { mDeviceFormat = format; } aaudio_format_t getDeviceFormat() const { return mDeviceFormat; } void setState(aaudio_stream_state_t state); void setDeviceId(int32_t deviceId) { Loading @@ -485,9 +510,23 @@ protected: float mDuckAndMuteVolume = 1.0f; protected: /** * Either convert the data from device format to app format and return a pointer * to the conversion buffer, * OR just pass back the original pointer. * * Note that this is only used for the INPUT path. * * @param audioData * @param numFrames * @return original pointer or the conversion buffer */ virtual const void * maybeConvertDeviceData(const void *audioData, int32_t numFrames) { return audioData; } void setPeriodNanoseconds(int64_t periodNanoseconds) { mPeriodNanoseconds.store(periodNanoseconds, std::memory_order_release); } Loading Loading @@ -539,6 +578,10 @@ private: int32_t mSessionId = AAUDIO_UNSPECIFIED; // Sometimes the hardware is operating with a different format from the app. // Then we require conversion in AAudio. aaudio_format_t mDeviceFormat = AAUDIO_FORMAT_UNSPECIFIED; // callback ---------------------------------- AAudioStream_dataCallback mDataCallbackProc = nullptr; // external callback functions Loading Loading
media/libaaudio/src/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ cc_library { shared_libs: [ "libaudioclient", "libaudioutils", "liblog", "libcutils", "libutils", Loading
media/libaaudio/src/client/AudioStreamInternal.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ aaudio_result_t AudioStreamInternal::open(const AudioStreamBuilder &builder) { setInputPreset(configurationOutput.getInputPreset()); // Save device format so we can do format conversion and volume scaling together. mDeviceFormat = configurationOutput.getFormat(); setDeviceFormat(configurationOutput.getFormat()); result = mServiceInterface.getStreamDescription(mServiceStreamHandle, mEndPointParcelable); if (result != AAUDIO_OK) { Loading
media/libaaudio/src/client/AudioStreamInternal.h +0 −5 Original line number Diff line number Diff line Loading @@ -138,8 +138,6 @@ protected: // Calculate timeout for an operation involving framesPerOperation. int64_t calculateReasonableTimeout(int32_t framesPerOperation); aaudio_format_t getDeviceFormat() const { return mDeviceFormat; } int32_t getDeviceChannelCount() const { return mDeviceChannelCount; } /** Loading Loading @@ -195,9 +193,6 @@ private: int64_t mServiceLatencyNanos = 0; // Sometimes the hardware is operating with a different format or channel count from the app. // Then we require conversion in AAudio. aaudio_format_t mDeviceFormat = AAUDIO_FORMAT_UNSPECIFIED; int32_t mDeviceChannelCount = 0; }; Loading
media/libaaudio/src/core/AudioStream.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -367,7 +367,6 @@ aaudio_result_t AudioStream::joinThread(void** returnArg, int64_t timeoutNanosec return err ? AAudioConvert_androidToAAudioResult(-errno) : mThreadRegistrationResult; } aaudio_data_callback_result_t AudioStream::maybeCallDataCallback(void *audioData, int32_t numFrames) { aaudio_data_callback_result_t result = AAUDIO_CALLBACK_RESULT_STOP; Loading
media/libaaudio/src/core/AudioStream.h +44 −1 Original line number Diff line number Diff line Loading @@ -252,6 +252,20 @@ public: return AAudioConvert_formatToSizeInBytes(mFormat); } /** * This is only valid after setSamplesPerFrame() and setDeviceFormat() have been called. */ int32_t getBytesPerDeviceFrame() const { return mSamplesPerFrame * getBytesPerDeviceSample(); } /** * This is only valid after setDeviceFormat() has been called. */ int32_t getBytesPerDeviceSample() const { return AAudioConvert_formatToSizeInBytes(getDeviceFormat()); } virtual int64_t getFramesWritten() = 0; virtual int64_t getFramesRead() = 0; Loading Loading @@ -471,6 +485,17 @@ protected: mFormat = format; } /** * This should not be called after the open() call. */ void setDeviceFormat(aaudio_format_t format) { mDeviceFormat = format; } aaudio_format_t getDeviceFormat() const { return mDeviceFormat; } void setState(aaudio_stream_state_t state); void setDeviceId(int32_t deviceId) { Loading @@ -485,9 +510,23 @@ protected: float mDuckAndMuteVolume = 1.0f; protected: /** * Either convert the data from device format to app format and return a pointer * to the conversion buffer, * OR just pass back the original pointer. * * Note that this is only used for the INPUT path. * * @param audioData * @param numFrames * @return original pointer or the conversion buffer */ virtual const void * maybeConvertDeviceData(const void *audioData, int32_t numFrames) { return audioData; } void setPeriodNanoseconds(int64_t periodNanoseconds) { mPeriodNanoseconds.store(periodNanoseconds, std::memory_order_release); } Loading Loading @@ -539,6 +578,10 @@ private: int32_t mSessionId = AAUDIO_UNSPECIFIED; // Sometimes the hardware is operating with a different format from the app. // Then we require conversion in AAudio. aaudio_format_t mDeviceFormat = AAUDIO_FORMAT_UNSPECIFIED; // callback ---------------------------------- AAudioStream_dataCallback mDataCallbackProc = nullptr; // external callback functions Loading