}
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;