From 316542800930d753e013e281d627a1a49ea83c8b Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Wed, 11 Apr 2018 20:06:38 +0200 Subject: [PATCH] Ask for no buffering when opening FFmpeg streams; we do our own buffering, and the stream could be a live one. --- ffmpeg_capture.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffmpeg_capture.cpp b/ffmpeg_capture.cpp index e7f25e3..bbbb941 100644 --- a/ffmpeg_capture.cpp +++ b/ffmpeg_capture.cpp @@ -349,7 +349,10 @@ bool FFmpegCapture::play_video(const string &pathname) last_modified = buf.st_mtim; } - auto format_ctx = avformat_open_input_unique(pathname.c_str(), nullptr, nullptr); + AVDictionary *opts = nullptr; + av_dict_set(&opts, "fflags", "nobuffer", 0); + + auto format_ctx = avformat_open_input_unique(pathname.c_str(), nullptr, &opts); if (format_ctx == nullptr) { fprintf(stderr, "%s: Error opening file\n", pathname.c_str()); return false; -- 2.39.2