summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-12-10 21:52:41 +0100
committerCarl Hetherington <cth@carlh.net>2023-12-12 15:03:23 +0100
commitc5b966261b7b268f495d7a72b7af4d4e6a75e618 (patch)
tree55a68a1391372e1fdd6681dfd8bac6ca2988687a
parentb4a306418f70cd0f43f1b91a9bb96b1714c0fa25 (diff)
Prevent crash if you forget to call FilterGraph::setup().
-rw-r--r--src/lib/filter_graph.cc3
-rw-r--r--src/lib/filter_graph.h2
2 files changed, 3 insertions, 2 deletions
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<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();
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;