stream-labs / obs-studio-node

libOBS (OBS Studio) for Node.Js, Electron and similar tools
GNU General Public License v2.0
614 stars 99 forks source link

Delaying encoder destruction #1404

Closed avoitenko-logitech closed 8 months ago

avoitenko-logitech commented 8 months ago

Description

This is an attempt to fix crash on RTMP output creation.

Motivation and Context

During its construction RTMP stream uses data from a currently active codec. Because OBS_service::updateVideoStreamingEncoder recreates encoder every time someone wants to update it in simple mode, there is a possible gap when there is no encoder attached to output. So the goal of the fix is to destroy previous encoder only after the new one was created and avoid that gap and crash on null pointer.

I also updated other places in that component which might suffer from the same issue.

How Has This Been Tested?

Manually, Windows only

Types of changes

Checklist: