private VideoFrame SeekToFrame(int frameNumber) { var ts = frameNumber.ToTimestamp(Info.RealFrameRate, Info.TimeBase); if (frameNumber < FramePosition || frameNumber > FramePosition + mediaOptions.VideoSeekThreshold) { stream.OwnerFile.SeekFile(ts, Info.Index); } stream.AdjustPackets(frameNumber.ToTimestamp(Info.RealFrameRate, Info.TimeBase)); return(stream.RecentlyDecodedFrame); }