This PR fixed the prefetching logic when the playing is not sequential.
New prefetching algorithm:
Constraint: The frames within the buffer are required to form a contiguous sequence, meaning that consecutive frame indices must be present without any gaps.
When the requested frame is not inside the prefetching buffer, it will discard all previous frames, and start to prefetch from current frames.
For example, if the current prefetch buffer contains these frames:
[1, 2, 3, 4]
Then we request for the 10th frame, the prefetch buffer state will become:
[11, 12, 13, 14]
Test:
Setting:
buffer capacity= 4
make sure there is > 24 ply ascii files in ./Ply
Command used: cargo run --bin vvplay_async -- --buffer-capacity=4 ./Ply
Test 1: Request for a ready frame inside the buffer
// buffer result
[8(decoding), 9(decoding), 10(decoding), 11(decoding)]
-----------------------------------------------------------------------------
### Extra note:
- If the ``CameraPosition`` of previous frame is retrievable, the program will use that; else, it will just use the default ``CameraPosition``
- Once a frame is requested, there is no way to cancel it. All the previous ``FrameRequest`` needs to be processed in order for the current ``FrameRequest`` to be handled.
This PR fixed the prefetching logic when the playing is not sequential.
New prefetching algorithm:
Constraint: The frames within the buffer are required to form a contiguous sequence, meaning that consecutive frame indices must be present without any gaps.
When the requested frame is not inside the prefetching buffer, it will discard all previous frames, and start to prefetch from current frames.
For example, if the current prefetch buffer contains these frames:
Then we request for the 10th frame, the prefetch buffer state will become:
Test:
Setting:
cargo run --bin vvplay_async -- --buffer-capacity=4 ./Ply
Test 1: Request for a ready frame inside the buffer
//then use UI to jump to frame 3
//result [3(ready), 4(ready), 5(ready), 6(ready)]
// buffer setup [1(ready), 2(ready), 3(ready), 4(decoding)]
//use UI to jump to frame 4
//buffer result [4(ready), 5(decoding), 6(decoding), 7(decoding)]
// buffer setup [1(ready), 2(decoding), 3(decoding), 4(decoding)]
//use UI to jump to frame 10
// result [10(decoding), 11(decoding), 12(decoding), 13(decoding)]
// buffer setup [20(ready), 21(ready), 22(ready), 23(ready)]
// use UI to jump to frame 8
// buffer result [8(decoding), 9(decoding), 10(decoding), 11(decoding)]