l-smash icon indicating copy to clipboard operation
l-smash copied to clipboard

Optimize DTS calculation to fix linear access slowdown

Open Asd-g opened this issue 5 months ago • 1 comments

Problem: When reading a file with B-frames, the decoding order is non-sequential. This caused isom_get_dts_from_info_list to repeatedly scan the entire sample list from the beginning, leading to a performance slowdown that worsened as the video progressed.

Solution: Cache the last accessed sample number and its DTS. When the next requested sample is forward in the timeline, start the DTS calculation from the cached position instead of from the start. This changes the operation from O(N) to O(N-M) for forward seeks.

Asd-g avatar Jul 05 '25 20:07 Asd-g

The concept itself seems OK, it just needs to be fixed to use the correct L-SMASH coding style (e.g. for spacing), and then I'll run it through tests.

dwbuiten avatar Aug 27 '25 15:08 dwbuiten

Pushed with corrected syntax.

Asd-g avatar Dec 01 '25 01:12 Asd-g