ossrs / srs

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

RTC: Refine FFmpeg opus audio noisy issue. v5.0.197 v6.0.97 #3852

Closed chundonglinlin closed 8 months ago

chundonglinlin commented 8 months ago

Description

When converting between AAC and Opus formats (aac2opus or opus2aac), the av_frame_get_buffer API is frequently called.

Objective

The goal is to optimize the code logic and reduce the frequent allocation and deallocation of memory.

In the case of aac2opus, av_frame_get_buffer is still frequently called. In the case of opus2aac, the goal is to avoid calling av_frame_get_buffer and reduce memory allocations.

Additional Note

Before calling the av_audio_fifo_read API, use av_frame_make_writable to check if the frame is writable. If it is not writable, create a new frame.


TRANS_BY_GPT4


Co-authored-by: john hondaxiao@tencent.com

winlinvip commented 8 months ago

Why should we make this change? What problems might arise? What issues does it solve?

TRANS_BY_GPT4