diff --git a/src/FFmpegReader.cpp b/src/FFmpegReader.cpp index d5d51d52..86ada05c 100644 --- a/src/FFmpegReader.cpp +++ b/src/FFmpegReader.cpp @@ -921,6 +921,11 @@ std::shared_ptr FFmpegReader::ReadStream(int64_t requested_frame) { continue; } + // Packet may become NULL on Close inside Seek if CheckSeek returns false + if (!packet) + // Jump to the next iteration of this loop + continue; + // Get the AVFrame from the current packet frame_finished = GetAVFrame(); @@ -957,6 +962,11 @@ std::shared_ptr FFmpegReader::ReadStream(int64_t requested_frame) { continue; } + // Packet may become NULL on Close inside Seek if CheckSeek returns false + if (!packet) + // Jump to the next iteration of this loop + continue; + // Update PTS / Frame Offset (if any) UpdatePTSOffset(false);