Skip to content

README: clarify streamed reader lifetime - #315

Merged
hajimehoshi merged 1 commit into
ebitengine:mainfrom
kumagi:codex/readme-reader-lifetime
Oct 9, 2026
Merged

hajimehoshi merged 1 commit into
ebitengine:mainfrom
kumagi:codex/readme-reader-lifetime

Conversation

@kumagi

@kumagi kumagi commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

What issue is this addressing?

None

What type of issue is this addressing?

Documentation

What this PR does | solves

The streaming note suggests retaining the original file separately in a struct to prevent garbage collection. A reachable player already retains its reader, and the MP3 decoder used in this example retains the file.

Describe the actual lifetime requirement: keep the player reachable, and avoid explicitly closing the file while it is being read. Point to PauseAndStopReading for stopping reads before closing the file.

Validation

Traced Context.NewPlayer through mux.NewPlayer's retained source, and verified go-mp3's Decoder/source retains the original reader. Checked the existing NewPlayer and PauseAndStopReading contracts. No runtime behavior or example code changes.

  • go test -race ./internal/... passed.
  • go build ./... and git diff --check passed on macOS ARM64.
  • No new tests added for the prose correction. The full native suite's existing AudioQueueStart failure / TestSetBufferSize timeout and Darwin unsafe.Pointer vet warning were previously reproduced on the unchanged upstream base; this PR does not address them.

@hajimehoshi hajimehoshi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hajimehoshi
hajimehoshi merged commit 542062d into ebitengine:main Oct 9, 2026
9 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