Prevent crash if you forget to call FilterGraph::setup().
authorCarl Hetherington <cth@carlh.net>
Sun, 10 Dec 2023 20:52:41 +0000 (21:52 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 12 Dec 2023 14:03:23 +0000 (15:03 +0100)
src/lib/filter_graph.cc
src/lib/filter_graph.h

index 2dbb2afc3e3f4abd147e6af8936f546df857848a..745d980a40597b6b4d07c78685893f46e1271f01 100644 (file)
@@ -55,10 +55,11 @@ FilterGraph::setup(vector<Filter> 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();
index 315aa7835c8a108b016b9109947f2f230c6a30bc..e474f851f47af56ffe6096b583a937202d82ad86 100644 (file)
@@ -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;