Skip to content

MediaPublish: use min_segment_wallclock_s for audio-only segment_time#22

Open
chrishobcroft wants to merge 1 commit into
livepeer:ja/live-runnerfrom
chrishobcroft:fix/audio-only-segment-time
Open

MediaPublish: use min_segment_wallclock_s for audio-only segment_time#22
chrishobcroft wants to merge 1 commit into
livepeer:ja/live-runnerfrom
chrishobcroft:fix/audio-only-segment-time

Conversation

@chrishobcroft
Copy link
Copy Markdown

The audio-only branch hardcoded segment_time to 2.0 s, which both set an unnecessary ~2 s latency floor on audio-only trickle publishers and made MediaPublishConfig.min_segment_wallclock_s look like a knob that does nothing on this path (it's only checked as a lower bound at the segment post-loop level; the PyAV segment muxer cuts well before it's consulted).

For audio-only streams there's no keyframe constraint, so derive segment_time from min_segment_wallclock_s instead, with a 0.1 s floor to guard against pathological inputs. Default behaviour is unchanged for anyone who didn't set the field (1.0 s) — still shorter than the old 2.0 s hardcode. Video path is untouched.

Measured on a mic-to-trickle audio-only publisher with min_segment_wallclock_s=0.3:

before: POST cadence 1.5-1.9 s, segments 30-43 KB
after: POST cadence 0.3-0.6 s, segments 6-13 KB

Fixes #21.

The audio-only branch hardcoded segment_time to 2.0 s, which both set an
unnecessary ~2 s latency floor on audio-only trickle publishers and made
MediaPublishConfig.min_segment_wallclock_s look like a knob that does
nothing on this path (it's only checked as a lower bound at the segment
post-loop level; the PyAV segment muxer cuts well before it's consulted).

For audio-only streams there's no keyframe constraint, so derive
segment_time from min_segment_wallclock_s instead, with a 0.1 s floor to
guard against pathological inputs. Default behaviour is unchanged for
anyone who didn't set the field (1.0 s) — still shorter than the old
2.0 s hardcode. Video path is untouched.

Measured on a mic-to-trickle audio-only publisher with
min_segment_wallclock_s=0.3:

  before: POST cadence 1.5-1.9 s, segments 30-43 KB
  after:  POST cadence 0.3-0.6 s, segments 6-13 KB

Refs livepeer#21.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e954553f-caa4-4f03-8390-7240f2ab4f2c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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