core: Fix NetStream playback stalling when play() is called after EOF#23390
Open
turicfr wants to merge 3 commits intoruffle-rs:masterfrom
Open
core: Fix NetStream playback stalling when play() is called after EOF#23390turicfr wants to merge 3 commits intoruffle-rs:masterfrom
turicfr wants to merge 3 commits intoruffle-rs:masterfrom
Conversation
- Extract `reset_buffer()` out from the asynchronous `load_netstream` closure in `loader.rs` and execute it synchronously inside `NetStream::play()`. - Before executing the EOF auto-pause inside `NetStream::tick()`, we now evaluate `Gc::ptr_eq` against the original `source` pointer to verify that the backing buffer hasn't been reset during the status event dispatch.
This ensures end-of-video event triggers can reliably resume playback without hanging on the same tick.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a NetStream naturally reaches the end of a video, it synchronously dispatches a NetStream.Play.Stop status event and then abruptly pauses itself. If a synchronous ActionScript event handler listens to this event and tries to replay the video using
stream.play(), the stream would previously become incorrectly paused right after, because the EOF pause evaluation proceeded regardless of whether the stream was modified.reset_buffer()out from the asynchronousload_netstreamclosure inloader.rsand execute it synchronously insideNetStream::play().NetStream::tick(), we now evaluateGc::ptr_eqagainst the originalsourcepointer to verify that the backing buffer hasn't been reset during the status event dispatch.An AVM2 test case is also included.