]> git.sesse.net Git - nageru/commitdiff
Fix an issue where Matroska HTTP FFmpeg streams would not correctly restart on connec...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 9 Mar 2019 21:01:00 +0000 (22:01 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 9 Mar 2019 21:01:00 +0000 (22:01 +0100)
nageru/ffmpeg_capture.cpp

index 722d313da4d65cdc6efb3c0fab692d70fb763cf5..9beea857dd3ed41bdb69df3fae26cfe5123bb305 100644 (file)
@@ -467,6 +467,11 @@ bool FFmpegCapture::play_video(const string &pathname)
                }
                if (frame == nullptr) {
                        // EOF. Loop back to the start if we can.
+                       if (format_ctx->pb != nullptr && format_ctx->pb->seekable == 0) {
+                               // Not seekable (but seemingly, sometimes av_seek_frame() would return 0 anyway,
+                               // so don't try).
+                               return true;
+                       }
                        if (av_seek_frame(format_ctx.get(), /*stream_index=*/-1, /*timestamp=*/0, /*flags=*/0) < 0) {
                                fprintf(stderr, "%s: Rewind failed, not looping.\n", pathname.c_str());
                                return true;