Loading apex/Android.bp +8 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,10 @@ apex { manifest: "manifest.json", defaults: ["com.android.media-defaults"], prebuilts: ["current_sdkinfo"], licenses: [ "frameworks_av_license", "opensourcerequest", ], } linker_config { Loading Loading @@ -251,6 +255,10 @@ apex { name: "com.android.media.swcodec", manifest: "manifest_codec.json", defaults: ["com.android.media.swcodec-defaults"], licenses: [ "frameworks_av_license", "opensourcerequest", ], } apex_key { Loading include/private/media/AudioTrackShared.h +7 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <stdint.h> #include <sys/types.h> #include <audio_utils/atomic.h> #include <audio_utils/minifloat.h> #include <utils/threads.h> #include <utils/Log.h> Loading Loading @@ -315,7 +316,12 @@ protected: const bool mIsOut; // true for AudioTrack, false for AudioRecord const bool mClientInServer; // true for OutputTrack, false for AudioTrack & AudioRecord bool mIsShutdown; // latch set to true when shared memory corruption detected size_t mUnreleased; // unreleased frames remaining from most recent obtainBuffer // mUnreleased is the number frames remaining from most recent obtainBuffer(s). // Generally accessed by a single thread, but for Java offload, // this variable may be accessed from multiple threads. It is used to // bounds check the releaseBuffer call after the obtainBuffer. audio_utils::atomic<size_t, audio_utils::memory_order_relaxed> mUnreleased; }; // ---------------------------------------------------------------------------- Loading media/libaaudio/src/client/AudioStreamInternal.cpp +0 −5 Original line number Diff line number Diff line Loading @@ -870,11 +870,6 @@ aaudio_result_t AudioStreamInternal::processData(void *buffer, int32_t numFrames framesLeft -= (int32_t) framesProcessed; audioData += framesProcessed * getBytesPerFrame(); if (framesLeft <= 0) { // No need to wait, all data has been written. break; } // Should we block? if (timeoutNanoseconds == 0) { break; // don't block Loading media/libaudioclient/AudioTrackShared.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -271,7 +271,7 @@ status_t ClientProxy::obtainBuffer(Buffer* buffer, const struct timespec *reques // take the maximum of the two mUnreleased (consistency check variable) // to avoid triggering an assertion on releaseBuffer. // TODO(b/419572928) improve this logic. mUnreleased = std::max(mUnreleased, part1); mUnreleased.max(part1); status = NO_ERROR; break; } Loading Loading @@ -401,7 +401,7 @@ void ClientProxy::releaseBuffer(Buffer* buffer) LOG_ALWAYS_FATAL_IF(!(stepCount <= mUnreleased && mUnreleased <= mFrameCount), "%s: mUnreleased out of range, " "!(stepCount:%zu <= mUnreleased:%zu <= mFrameCount:%zu), BufferSizeInFrames:%u", __func__, stepCount, mUnreleased, mFrameCount, getBufferSizeInFrames()); __func__, stepCount, mUnreleased.load(), mFrameCount, getBufferSizeInFrames()); mUnreleased -= stepCount; audio_track_cblk_t* cblk = mCblk; // Both of these barriers are required Loading Loading @@ -922,7 +922,7 @@ void ServerProxy::releaseBuffer(Buffer* buffer) LOG_ALWAYS_FATAL_IF(!(stepCount <= mUnreleased && mUnreleased <= mFrameCount), "%s: mUnreleased out of range, " "!(stepCount:%zu <= mUnreleased:%zu <= mFrameCount:%zu)", __func__, stepCount, mUnreleased, mFrameCount); __func__, stepCount, mUnreleased.load(), mFrameCount); mUnreleased -= stepCount; audio_track_cblk_t* cblk = mCblk; if (mIsOut) { Loading Loading @@ -1235,7 +1235,7 @@ void StaticAudioTrackServerProxy::releaseBuffer(Buffer* buffer) LOG_ALWAYS_FATAL_IF(!(stepCount <= mUnreleased), "%s: stepCount out of range, " "!(stepCount:%zu <= mUnreleased:%zu)", __func__, stepCount, mUnreleased); __func__, stepCount, mUnreleased.load()); if (stepCount == 0) { // prevent accidental re-use of buffer buffer->mRaw = NULL; Loading services/camera/virtualcamera/VirtualCameraSession.cc +2 −1 Original line number Diff line number Diff line Loading @@ -188,7 +188,8 @@ HalStream getHalStream(const Stream& stream) { halStream.producerUsage = static_cast<BufferUsage>( static_cast<int64_t>(stream.usage) | static_cast<int64_t>(BufferUsage::CAMERA_OUTPUT) | static_cast<int64_t>(BufferUsage::GPU_RENDER_TARGET)); static_cast<int64_t>(BufferUsage::GPU_RENDER_TARGET) | static_cast<int64_t>(BufferUsage::CPU_WRITE_OFTEN)); halStream.supportOffline = false; return halStream; Loading Loading
apex/Android.bp +8 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,10 @@ apex { manifest: "manifest.json", defaults: ["com.android.media-defaults"], prebuilts: ["current_sdkinfo"], licenses: [ "frameworks_av_license", "opensourcerequest", ], } linker_config { Loading Loading @@ -251,6 +255,10 @@ apex { name: "com.android.media.swcodec", manifest: "manifest_codec.json", defaults: ["com.android.media.swcodec-defaults"], licenses: [ "frameworks_av_license", "opensourcerequest", ], } apex_key { Loading
include/private/media/AudioTrackShared.h +7 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <stdint.h> #include <sys/types.h> #include <audio_utils/atomic.h> #include <audio_utils/minifloat.h> #include <utils/threads.h> #include <utils/Log.h> Loading Loading @@ -315,7 +316,12 @@ protected: const bool mIsOut; // true for AudioTrack, false for AudioRecord const bool mClientInServer; // true for OutputTrack, false for AudioTrack & AudioRecord bool mIsShutdown; // latch set to true when shared memory corruption detected size_t mUnreleased; // unreleased frames remaining from most recent obtainBuffer // mUnreleased is the number frames remaining from most recent obtainBuffer(s). // Generally accessed by a single thread, but for Java offload, // this variable may be accessed from multiple threads. It is used to // bounds check the releaseBuffer call after the obtainBuffer. audio_utils::atomic<size_t, audio_utils::memory_order_relaxed> mUnreleased; }; // ---------------------------------------------------------------------------- Loading
media/libaaudio/src/client/AudioStreamInternal.cpp +0 −5 Original line number Diff line number Diff line Loading @@ -870,11 +870,6 @@ aaudio_result_t AudioStreamInternal::processData(void *buffer, int32_t numFrames framesLeft -= (int32_t) framesProcessed; audioData += framesProcessed * getBytesPerFrame(); if (framesLeft <= 0) { // No need to wait, all data has been written. break; } // Should we block? if (timeoutNanoseconds == 0) { break; // don't block Loading
media/libaudioclient/AudioTrackShared.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -271,7 +271,7 @@ status_t ClientProxy::obtainBuffer(Buffer* buffer, const struct timespec *reques // take the maximum of the two mUnreleased (consistency check variable) // to avoid triggering an assertion on releaseBuffer. // TODO(b/419572928) improve this logic. mUnreleased = std::max(mUnreleased, part1); mUnreleased.max(part1); status = NO_ERROR; break; } Loading Loading @@ -401,7 +401,7 @@ void ClientProxy::releaseBuffer(Buffer* buffer) LOG_ALWAYS_FATAL_IF(!(stepCount <= mUnreleased && mUnreleased <= mFrameCount), "%s: mUnreleased out of range, " "!(stepCount:%zu <= mUnreleased:%zu <= mFrameCount:%zu), BufferSizeInFrames:%u", __func__, stepCount, mUnreleased, mFrameCount, getBufferSizeInFrames()); __func__, stepCount, mUnreleased.load(), mFrameCount, getBufferSizeInFrames()); mUnreleased -= stepCount; audio_track_cblk_t* cblk = mCblk; // Both of these barriers are required Loading Loading @@ -922,7 +922,7 @@ void ServerProxy::releaseBuffer(Buffer* buffer) LOG_ALWAYS_FATAL_IF(!(stepCount <= mUnreleased && mUnreleased <= mFrameCount), "%s: mUnreleased out of range, " "!(stepCount:%zu <= mUnreleased:%zu <= mFrameCount:%zu)", __func__, stepCount, mUnreleased, mFrameCount); __func__, stepCount, mUnreleased.load(), mFrameCount); mUnreleased -= stepCount; audio_track_cblk_t* cblk = mCblk; if (mIsOut) { Loading Loading @@ -1235,7 +1235,7 @@ void StaticAudioTrackServerProxy::releaseBuffer(Buffer* buffer) LOG_ALWAYS_FATAL_IF(!(stepCount <= mUnreleased), "%s: stepCount out of range, " "!(stepCount:%zu <= mUnreleased:%zu)", __func__, stepCount, mUnreleased); __func__, stepCount, mUnreleased.load()); if (stepCount == 0) { // prevent accidental re-use of buffer buffer->mRaw = NULL; Loading
services/camera/virtualcamera/VirtualCameraSession.cc +2 −1 Original line number Diff line number Diff line Loading @@ -188,7 +188,8 @@ HalStream getHalStream(const Stream& stream) { halStream.producerUsage = static_cast<BufferUsage>( static_cast<int64_t>(stream.usage) | static_cast<int64_t>(BufferUsage::CAMERA_OUTPUT) | static_cast<int64_t>(BufferUsage::GPU_RENDER_TARGET)); static_cast<int64_t>(BufferUsage::GPU_RENDER_TARGET) | static_cast<int64_t>(BufferUsage::CPU_WRITE_OFTEN)); halStream.supportOffline = false; return halStream; Loading