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 leaks in Socket #40

Closed vitkuzmenko closed 1 month ago

vitkuzmenko commented 1 month ago

Context

When streaming, the use of outputBuffer.removeFirst(data.count) does not effectively free memory, which can lead to inefficiencies.

Change

Based on advice from an Apple Engineer, I replaced removeFirst with removeSubrange to optimize memory usage.

Before

Screenshot 2024-08-19 at 16 06 12

After

Screenshot 2024-08-19 at 16 08 06
pedroSG94 commented 1 month ago

Thank you! Merged