Repository navigation
sim: the host sink reports the pipeline's end-of-stream - #925
Merged
Merged
Conversation
#865 made a film end on the pipeline's own end-of-stream (type=28), but the simulator's HostSink never sent one: its clock stops at the last fed VIDEO pts, so a film whose audio outlasts its video hung there exactly as on the television, and #865's arm could not fire. sf_push_eos now latches the push; once the clock has played out to the last fed video frame, the ticker sends type=28 num=1 str=true through the real callback, once per pushed EOS. The latch is cleared wherever the fed timeline restarts (Clock::rewind, sf_seek_ms). Clock::tick is split out of the ticker thread so a test can take a tick on its own thread. A hostsim regression test drives the real feed lanes and the real pump against HostSink (video to 20 s, audio to 23 s, duration 23 s) and asserts player::ended(); it also grades that nothing is sent before an EOS is pushed. Sink-level tests grade the latch. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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.
What the simulator could not do
Follow-up to #865, which made a film end on the pipeline's own end-of-stream (
type=28,Shared::pipeline_eos) because a film whose audio outlasts its video never brings the playhead within a second of the container's duration.The simulator's
HostSink(rust-modules/media/src/player/ffi_host.rs) clamps its clock to the highest VIDEO pts it was fed and never sent atype=28. A film whose audio outlasts its video therefore stalled at the video tail on the simulator exactly as on the television, and #865's new arm could not fire there.What it does now
sf_push_eoslatches the push.type=28 num=1 str=truethrough the realsf_on_event(never by writingSHARED), once per pushed EOS. A paused clock sends nothing, and nothing is sent before an EOS is pushed.Clock::rewind(whichsf_load,sf_flush,sf_unload,sf_destroyandsf_quarantineall call) andsf_seek_ms.Clock::tickis split out of the ticker thread so a test can take a tick on its own thread.Shared::pipeline_eos. Nothing else in player: a film ends on the pipeline's end-of-stream #865's code changed.Device evidence the plant mirrors
Both show the same order:
type=28arrives after the last video frame is presented, while the clock stays at the video tail.smp_cb type=28 num=1 str=truewas the only sign the pipeline had finished.tests/run.py --pipeline --filter pipe_finish_eoswith a 720x480 H.264 + AC3 clip whose video ends at 20 s and audio at 23 s.ffc9c44dd):EOS pushed at true EOF, remaining audio refused (feed a#800 ... fed=21979000000 reply=e), clock stuck atpos=19s, thensmp_cb type=28 num=1 str=true, then nothing.finishedFAILED, max_stall 36 s.mainat60538b68:EOS pushed at true EOF->smp_cb type=28 num=1 str=true->smp: the pipeline reached end-of-stream->EOS reached: playpos=19s/23s -> ended->stop_bufferfeed: torn down. PASS.Red, then green
player::pump::end_of_film_tests::a_film_whose_audio_outlasts_its_video_ends_on_the_host_sinkdrives the real feed lanes and the realpumpagainstHostSink(video AUs to 20 s, audio AUs to 23 s, duration 23 s, a real hostLoadso the callback gate is open). It never setspipeline_eosorended. Phase one runs the clock to the video tail with the demuxer still producing and asserts nothing was sent; phase two completes both lanes, lets the engine push the EOS, and assertsplayer::ended(). The sink-level tests inffi_host.rsgrade the latch (once per push, waits for the clock, silent while paused, withdrawn by a rewind, flush, seek or unload).Without the plant (
make test-hostsim C=plx_media T=a_film_whose_audio_outlasts_its_video_ends_on_the_host_sink):With it:
Full
make test-hostsim C=plx_media:test result: ok. 1862 passed; 0 failed; 64 ignored; 0 measured; 0 filtered out; finished in 42.28s.Simulator run, real demuxer
macOS simulator,
plxnative-clocksink, a 640x360 H.264 + AAC clip whose video ends at 20 s and audio at 23 s (container duration 23.023 s), served bytests/serve_fixtures.py, a synthetic token andtests/mock_pms.py. No real account.Before (simulator built from unmodified
main): the playhead sits atpos=19swithplay=0pmfor the rest of the run (37 heartbeats), and the log has nosmp_cb type=28and noEOS reached. Thestop_bufferfeed: torn downat the end of that log is the harness's SIGTERM at 60 s, not the film ending.After (this branch):
Verification
On the committed tree (
git status --shortempty before and after):make check: exit 0. Its hostsim pass forplx_media:test result: ok. 1862 passed; 0 failed; 64 ignored; 0 measured; 0 filtered out; finished in 90.63s. For the application crate (plxnative_modules):test result: ok. 1038 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 72.86s. Its plain pass forplx_media:test result: ok. 1703 passed; 0 failed; 64 ignored; 0 measured; 0 filtered out; finished in 48.05s.make check-nodef:Finished dev profilewith no errors.type=28arrives is already measured on two devices above. The ARM cross-build does not compileffi_host.rs.Left alone:
tests/README.md, "Playing to the END", still says the pump gatesEOS reachedoneos_pushed && pos >= dur - 1s; that has not been true since #865.🤖 Generated with Claude Code