Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed prefetching logic #48

Merged
merged 13 commits into from
May 26, 2024
Merged

Conversation

tiif
Copy link
Contributor

@tiif tiif commented Dec 30, 2023

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 setup
[1(ready), 2(ready), 3(ready), 4(ready)]

//then use UI to jump to frame 3

//result
[3(ready), 4(ready), 5(ready), 6(ready)]
  • Test 2: Request for a not ready frame inside the buffer
// 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)]
  • Test 3: Request for a frame which is not inside the buffer > current frame range in buffer, and is not in the playback cache either
// 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)]
  • Test 4: Request for a frame which is not inside the buffer < current frame range in buffer, and is not in the playback cache either
// 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)]

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.

@tiif tiif marked this pull request as ready for review January 9, 2024 13:21
@weitsang weitsang merged commit 00c6d8a into nus-vv-streams:main May 26, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants