9ef263f81a
Fix an issue in the way AVFrames were handled in the FFmpeg encoder plugin, which could lead to tearing in the encoded video due to data races in the AVFrame and AVBuffer. This is fixed by calling av_frame_make_writable which ensures the frame and its associated buffer are writable. If its not, it will copy the AVFrame, create a new AVBuffer for it and decrease the refcount of the old AVFrame and AVBuffer. This way OBS always ends up with a usable buffer to write into which is not still used by the encoder while avoiding a copy when unnecessary.