From 81fc392bc2184a4bc84808701eae518acad8f313 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 10 Jan 2022 19:56:00 -0500 Subject: [PATCH] If error is ENOSPACE just give up. ffmpeg crashes if we try again. --- src/zm_videostore.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/zm_videostore.cpp b/src/zm_videostore.cpp index ad401b22c..0038348ef 100644 --- a/src/zm_videostore.cpp +++ b/src/zm_videostore.cpp @@ -497,8 +497,14 @@ bool VideoStore::open() { Debug(1, "using movflags %s", movflags_entry->value); } if ((ret = avformat_write_header(oc, &opts)) < 0) { - Warning("Unable to set movflags trying with defaults."); - ret = avformat_write_header(oc, nullptr); + // we crash if we try again + if (ENOSPC != ret) { + Warning("Unable to set movflags trying with defaults.%d %s", + ret, av_make_error_string(ret).c_str()); + + ret = avformat_write_header(oc, nullptr); + Debug(1, "Done %d", ret); + } } else if (av_dict_count(opts) != 0) { Info("some options not used, turn on debugging for a list."); AVDictionaryEntry *e = nullptr;