From: Steinar H. Gunderson Date: Wed, 11 Apr 2018 18:06:38 +0000 (+0200) Subject: Ask for no buffering when opening FFmpeg streams; we do our own buffering, and the... X-Git-Tag: 1.7.2~42 X-Git-Url: https://git.sesse.net/?p=nageru;a=commitdiff_plain;h=316542800930d753e013e281d627a1a49ea83c8b Ask for no buffering when opening FFmpeg streams; we do our own buffering, and the stream could be a live one. --- 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;