Skip to content

audioencoder: Avoid using temporarily mapped memory as base for input buffers

Noticed when working on !6254 (merged), because the encoder was acting up in certain (low bitrate/high sample rate) scenarios without any sensible explanation. That was, until I checked pointer addresses given to it when mapping the input buffer, and they were the exact same one every time - even when I wasn't unmapping/unreffing them after use 🙂

audioencoder: Avoid wrapping temporarily mapped memory with a GstBuffer and passing that to subclass

Memory from gst_adapter_map() could live shorter than the GstMemory that the GstBuffer wraps around it, which in lucky
cases 'just' caused a re-use of the same memory for multiple (potentially still in use!) input buffers, but could easily
end up pointing to an already-freed memory.

Manifested when an AudioToolbox encoder kept getting silence inserted in seemingly random circumstances, turned out
to be the memory being reused by GStreamer while the AT API was still processing it...

Merge request reports