Skip to content

Media: keep playback with the document and the clip (#415) - #483

Merged
h-a-n-a-s-h-i merged 1 commit into
storytold:mainfrom
NikitkaRa:cursor/media-playback-identity-d175
Oct 14, 2026
Merged

h-a-n-a-s-h-i merged 1 commit into
storytold:mainfrom
NikitkaRa:cursor/media-playback-identity-d175

Conversation

@NikitkaRa

Copy link
Copy Markdown
Contributor

Summary

  • Playback belongs to the open presentation. Switching decks, or closing the last one, stops the previous voices and GIF clocks, so a shape id shared by two decks cannot keep the old clip.
  • Replacing a clip while it is playing swaps in the new audio, duration, and video feed. Resuming the same source still continues from where it paused.
  • The decode cache and the duration cache keep the source bytes they are keyed by, and the duration cache stays within 16 entries, so a freed allocation cannot be reused as a stale hit.

Test plan

  • cargo test -p deckcraft-media --lib player::tests (including replacement of a voice's source, retained cache bytes, and resume of the same source)
  • cargo test -p deckcraft-ui-egui --lib media::tests (two decks with the same shape id, clip replacement, last-document close, GIF clocks)
  • cargo clippy -p deckcraft-media -p deckcraft-ui-egui --all-targets -- -D warnings
  • cargo fmt --all -- --check, cargo clippy --workspace --all-targets -- -D warnings, cargo xtask assets, cargo xtask layers, cargo xtask wasm
  • cargo test --workspace also runs deckcraft-text symbol_font_characters_draw_in_the_sym_font, which fails on this machine because Wingdings 2 is installed and claims U+F0DE. That crate is unchanged.

Closes #415

Shape ids are local to one presentation, and decoded audio was cached by the
address of a buffer the cache did not keep. Switching decks, closing the last
one, or replacing a clip could keep the previous sound. Playback now stops
when the document changes or closes, a new source replaces the voice's audio,
and the decode and duration caches hold the bytes they are keyed by.

Co-authored-by: Cursor <cursoragent@cursor.com>
@h-a-n-a-s-h-i
h-a-n-a-s-h-i merged commit 8d429a2 into storytold:main Oct 14, 2026
@echelon

echelon commented Oct 14, 2026

Copy link
Copy Markdown
Member

Thank you for this contribution, @NikitkaRa! It has landed on main and will ship in the next DeckCraft release.

If you haven't already, please come join us on Discord: https://discord.gg/artcraft

h-a-n-a-s-h-i pushed a commit that referenced this pull request Oct 14, 2026
…ntegrated on land-r3 (#518 #531 #535 #533 #572 #573 #577 #580 #583 #592 #685 #528 #483 #490 #441 #671 #679 #649 #656 #660 #664 #224)

# Conflicts:
#	crates/engine/src/tests.rs
#	crates/model/src/lib.rs
#	crates/pptx/src/write/mod.rs
#	crates/render/src/lib.rs
#	crates/ui-egui/src/canvas.rs
#	crates/ui-egui/src/lib.rs
#	crates/ui-egui/src/thumbs.rs
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.

[Audit] Playback and media caches use identities that can outlive or collide with their document/source

3 participants