-
-
Notifications
You must be signed in to change notification settings - Fork 767
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
avm2: Use actual ShowFrame tag count instead of header for most things #16730
base: master
Are you sure you want to change the base?
Conversation
|
||
if is_root && !swf.is_empty() { | ||
let mut reader = swf.read_from(0); | ||
let _ = tag_utils::decode_tags(&mut reader, tag_callback); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean we have to decode all the SWF tags twice now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but the actual decoding work here is just repeatedly reading tag codes and lengths. Also, it's only done for root clips.
41ea5ae
to
9bface6
Compare
frame.min(max(mc.frames_loaded_ignore_header(), 0) as FrameNumber) | ||
} else { | ||
// Sanity; let's make sure we don't seek way too far. | ||
frame.min(max(mc.frames_loaded(), 0) as FrameNumber) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean gotos in AVM1 that go past the frames in the header are clamped? I made a small test and AVM1 also seems to ignore the header frame count in FP.
9bface6
to
228b167
Compare
228b167
to
7d6265f
Compare
Just for completeness, as researched on Discord, this doesn't feel correct; as in: in FP, I can observe that the playhead doesn't stop at the last ShowFrame, but instead it actually processes tags until the last one, and only then it either loops or stops (but it doesn't treat it as a real "frame"). Ways to observe it:
Also, intuitively, the count-in-advance logic would interact badly with possible async download implementation. The way FP works does make sense if you think of the playhead as not knowing anything about the bytestream in advance and just parsing tags until either a ShowFrame or EOF. |
Some SWFS have 2 frames, but only declare 1 frames in the SWF header. This PR allows those swfs to advance to the next frame (either normally or via a goto).