mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-04-05 06:04:50 +00:00
lavc video: fixed crash when reinit fails
Fixed a crash in situation where compressing stream with properties A, then B but init fails and then again A. This can occur when using switcher for 1->2->1 when compress reconf fails for 2. But because `saved_desc` is set if reconf succeeds and was already set on first configure, the state is inconsistent because partially de/configured for 2 but it looks like it is still correctly configured to input 1 because `saved_desc` was not cleared. refers to GH-365
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* @author Martin Pulec <pulec@cesnet.cz>
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2013-2023 CESNET, z. s. p. o.
|
||||
* Copyright (c) 2013-2024 CESNET, z. s. p. o.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -253,7 +253,7 @@ struct state_video_compress_libav {
|
||||
struct module module_data;
|
||||
|
||||
struct video_desc saved_desc{};
|
||||
struct to_lavc_vid_conv *pixfmt_conversion = nullptr;;
|
||||
struct to_lavc_vid_conv *pixfmt_conversion = nullptr;
|
||||
AVPacket *pkt = av_packet_alloc();
|
||||
// for every core - parts of the above
|
||||
AVCodecContext *codec_ctx = nullptr;
|
||||
@@ -1057,6 +1057,7 @@ try_open_remaining_pixfmts(state_video_compress_libav *s, video_desc desc,
|
||||
|
||||
static bool configure_with(struct state_video_compress_libav *s, struct video_desc desc)
|
||||
{
|
||||
s->saved_desc = {};
|
||||
codec_t ug_codec = s->requested_codec_id == VIDEO_CODEC_NONE ? DEFAULT_CODEC : s->requested_codec_id;
|
||||
AVPixelFormat pix_fmt = AV_PIX_FMT_NONE;
|
||||
const AVCodec *codec = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user