Skip to content

feat: log seek targets, TV state changes and why a segment timed out - #27

Open
averma12 wants to merge 1 commit into
thepushkarp:mainfrom
averma12:feat/debug-logging
Open

averma12 wants to merge 1 commit into
thepushkarp:mainfrom
averma12:feat/debug-logging

Conversation

@averma12

Copy link
Copy Markdown
Contributor

Why

A burned-in HLS stream stalled on my TV about an hour into a film. The log had only these two lines to go on:

"POST /api/seek HTTP/1.1" 200 -
HLS /hls/<id>/<sub>/602.ts failed: segment 602 took over 60 s

That left three questions open: where the seek went, whether a pause came from the CLI/panel or from the TV itself, and whether ffmpeg was still working on the segment or had never started it.

What changes

Log lines only; no behaviour change.

  • play / pause / seek log their target and the position they were sent at, e.g. seek to 1:00:00 (was at 1:00:11).
  • TV transport state changes are logged once each, with the position and the cause: TV PAUSED_PLAYBACK at 1:00:11 (on the TV) or (after pause from here). "From here" means a command was sent within three poll intervals.
  • Segment timeouts say how long ffmpeg has been encoding the segment and how many bytes it has written, or that no worker picked it up, plus how many segments are ready.
  • An ffmpeg killed at its 120 s limit now reports that with its stderr, instead of a bare TimeoutExpired.

Testing

  • python3 -m unittest discover -s tests -t .: 166 of 169 pass. The 3 failures are in tests.test_cli.InstallTest and fail the same way on unpatched main here, because my checkout is under ~/Desktop.
  • Not yet exercised against a real TV on this branch. I wrote the same changes against 0.2.1 first; the new lines have not been observed in a live log yet.
  • No new unit tests.

Noticed, not changed

Hls.segment() waits 60 s for a segment while Hls.encode() lets ffmpeg run for 120 s. In the stall above the request gave up while ffmpeg kept running on that segment for another minute. Happy to follow up separately if you want those aligned.

🤖 Generated with Claude Code

When playback stalled on a burned-in HLS stream, the log said only
"POST /api/seek 200" and "segment 602 took over 60 s". That left out
where a seek went, whether a pause came from the CLI/panel or from the
TV itself, and whether ffmpeg was still encoding the segment.

- play/pause/seek log the target and the position they were sent at
- each change of the TV's transport state is logged once, with the
  position and whether a command from here preceded it
- a segment timeout says how long ffmpeg has been on it and how much it
  wrote; an ffmpeg killed at its 120 s limit reports its stderr

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant