pedroSG94 / RootEncoder-iOS

RootEncoder iOS (rtmp-rtsp-stream-client-swift) is a stream encoder to push video/audio to media servers using protocols RTMP, RTSP and SRT with all code written in Swift
Apache License 2.0
114 stars 34 forks source link

Fix Memory Leak in AVAudioConverter.convert #32

Closed vitkuzmenko closed 2 months ago

vitkuzmenko commented 2 months ago

When audio streaming is enabled, the app was allocating excessive memory.

Issue:

AVAudioConverter.convert was not freeing allocated memory, leading to a memory leak.

Solution:

This commit resolves the issue by wrapping the conversion process in an autoreleasepool.

Based on this solution: https://stackoverflow.com/questions/75943924/avaudioconverter-buffers-are-over-retained-in-a-dispatchqueue-concurrentperform

Before:

Before

After:

After
pedroSG94 commented 2 months ago

Thank you for the PR!! merged