mirror of
https://github.com/LizardByte/Sunshine.git
synced 2026-08-07 10:20:46 +00:00
fix(video): avoid nullptr deref segfault on encode session teardown (#5257)
This commit is contained in:
+2
-2
@@ -418,8 +418,8 @@ namespace video {
|
||||
avcodec_encode_session_t(avcodec_encode_session_t &&other) noexcept = default;
|
||||
|
||||
~avcodec_encode_session_t() {
|
||||
// Flush any remaining frames in the encoder
|
||||
if (avcodec_send_frame(avcodec_ctx.get(), nullptr) == 0) {
|
||||
// Flush any remaining frames in the encoder if the encoder started up (frame num > 0)
|
||||
if (avcodec_ctx->frame_num > 0 && avcodec_send_frame(avcodec_ctx.get(), nullptr) == 0) {
|
||||
packet_raw_avcodec pkt;
|
||||
while (avcodec_receive_packet(avcodec_ctx.get(), pkt.av_packet) == 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user