Skip to content

Commit 857297a

Browse files
authored
Merge pull request #288 from SuslikV/patch-5
Fix crash during seeking at the start of the file
2 parents 1cdddba + bacd46d commit 857297a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/FFmpegReader.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,11 @@ std::shared_ptr<Frame> FFmpegReader::ReadStream(int64_t requested_frame) {
921921
continue;
922922
}
923923

924+
// Packet may become NULL on Close inside Seek if CheckSeek returns false
925+
if (!packet)
926+
// Jump to the next iteration of this loop
927+
continue;
928+
924929
// Get the AVFrame from the current packet
925930
frame_finished = GetAVFrame();
926931

@@ -957,6 +962,11 @@ std::shared_ptr<Frame> FFmpegReader::ReadStream(int64_t requested_frame) {
957962
continue;
958963
}
959964

965+
// Packet may become NULL on Close inside Seek if CheckSeek returns false
966+
if (!packet)
967+
// Jump to the next iteration of this loop
968+
continue;
969+
960970
// Update PTS / Frame Offset (if any)
961971
UpdatePTSOffset(false);
962972

0 commit comments

Comments
 (0)