You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Fix crash during seeking at the start of the file
Due to seeking optimizations the file can be closed and reopened. The packet's pointer becomes NULL in this case. This change ensures that packet's pointer is valid after seeking performed (if any).
This commit is contained in:
@@ -921,6 +921,11 @@ std::shared_ptr<Frame> 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<Frame> 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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user