From: Carl Hetherington Date: Sun, 10 Dec 2023 20:52:41 +0000 (+0100) Subject: Prevent crash if you forget to call FilterGraph::setup(). X-Git-Tag: v2.16.71~10 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=c5b966261b7b268f495d7a72b7af4d4e6a75e618 Prevent crash if you forget to call FilterGraph::setup(). --- diff --git a/src/lib/filter_graph.cc b/src/lib/filter_graph.cc index 2dbb2afc3..745d980a4 100644 --- a/src/lib/filter_graph.cc +++ b/src/lib/filter_graph.cc @@ -55,10 +55,11 @@ FilterGraph::setup(vector const& filters) { auto const filters_string = Filter::ffmpeg_string (filters); if (filters.empty()) { - _copy = true; return; } + _copy = false; + _frame = av_frame_alloc (); _graph = avfilter_graph_alloc(); diff --git a/src/lib/filter_graph.h b/src/lib/filter_graph.h index 315aa7835..e474f851f 100644 --- a/src/lib/filter_graph.h +++ b/src/lib/filter_graph.h @@ -68,7 +68,7 @@ protected: AVFilterGraph* _graph = nullptr; /** true if this graph has no filters in, so it just copies stuff straight through */ - bool _copy = false; + bool _copy = true; AVFilterContext* _buffer_src_context = nullptr; AVFilterContext* _buffer_sink_context = nullptr; AVFrame* _frame = nullptr;