ossrs / srs

SRS is a simple, high-efficiency, real-time media server supporting RTMP, WebRTC, HLS, HTTP-FLV, HTTP-TS, SRT, MPEG-DASH, and GB28181.
https://ossrs.io
MIT License
25.47k stars 5.35k forks source link

HLS: Ignore empty NALU to avoid error. v6.0.65 #3750

Closed winlinvip closed 1 year ago

winlinvip commented 1 year ago

For the DJI M30, there is a bug where empty NALU packets with a size of zero are causing issues with HLS streaming. This bug leads to random unpublish events due to the SRS disconnecting the connection for the HLS module when it fails to handle empty NALU packets.

To address this bug, we have patched the system to ignore any empty NALU packets with a size of zero. Additionally, we have created a tool in the srs-bench to replay pcapng files captured by tcpdump or Wireshark. We have also added utest using mprotect and asan to detect any memory corruption.

It is important to note that this bug has been fixed in versions 4.0.271 6477f31004c7c5ff95715b9b3f3afc798e81704d and 5.0.170 939f6b484b34c7e1f73217ab79948fbd0b439dfa. This patch specifically addresses the issue in SRS 6.0.

Please be aware that there is another commit related to this bug that partially fixes the issue but still leaves a small problem for asan to detect memory corruption. This commit, 577cd299e1792cbc063b72a582688c2e2977bf22, only ignores empty NALU packets but still reads beyond the memory.


Co-authored-by: chundonglinlin chundonglinlin@163.com