Skip to content

feat(planner): show per-title audio bitrate in title breakdown#101

Merged
ScottMorris merged 1 commit into
mainfrom
fix/issue-70-planner-audio-breakdown
Jun 25, 2026
Merged

feat(planner): show per-title audio bitrate in title breakdown#101
ScottMorris merged 1 commit into
mainfrom
fix/issue-70-planner-audio-breakdown

Conversation

@ScottMorris

Copy link
Copy Markdown
Contributor

Fixes #70.

Summary

  • TitleBitrateAllocation in capacity.rs gains an audio_bits_per_second field — the value was already computed per-title by estimate_title_audio_bitrate_bps and used to reserve disc budget, but was thrown away before the struct was returned.
  • Mirrored as audioBitsPerSecond in the TypeScript binding (guest-js/index.ts).
  • Planner title rows now display X.XX Mbps audio (or NNN kbps audio) alongside the existing video stat. The audio line is suppressed when audioBitsPerSecond is 0 (title with no asset).

Test plan

  • Open a project with EAC3 5.1 audio — Planner should show e.g. 448 kbps audio next to the video line for each title.
  • Title with no asset should show no audio stat.
  • Existing capacity math and budget numbers should be unaffected (audio was already factored in).

🤖 Generated with Claude Code

https://claude.ai/code/session_01L3tSFK3P9vGwbNNtb4AYQG

The Planner's Title Breakdown card showed only a video bitrate figure per
title. Audio already factored into the disc capacity math (reserved out of
the budget before any video allocation), but was never surfaced in the UI —
leaving users unable to see how much of the disc budget their audio tracks
were actually consuming.

Changes:
- Added `audio_bits_per_second` to `TitleBitrateAllocation` in `capacity.rs`;
  the value was already computed per-title in `estimate_title_audio_bitrate_bps`
  and available in the allocation closure — it just wasn't threaded through.
- Mirrored `audioBitsPerSecond` in the TypeScript binding (`guest-js/index.ts`).
- Planner title rows now display `X.XX Mbps audio` (or `NNN kbps audio`)
  alongside the existing video line, suppressed when `audioBitsPerSecond` is 0
  (title with no asset/duration).
- Updated the PlannerPage test fixture and added an assertion that the audio
  stat renders correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L3tSFK3P9vGwbNNtb4AYQG
@ScottMorris

Copy link
Copy Markdown
Contributor Author

@codex review

@github-actions

Copy link
Copy Markdown

Spindle JS tests

233 tests  ±0   233 ✅ ±0   5s ⏱️ -1s
 24 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 3ae80c7. ± Comparison against base commit 4c911f8.

@github-actions

Copy link
Copy Markdown

Spindle Rust tests

222 tests  ±0   222 ✅ ±0   2s ⏱️ ±0s
  2 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 3ae80c7. ± Comparison against base commit 4c911f8.

@ScottMorris ScottMorris merged commit 5ec9a85 into main Jun 25, 2026
8 checks passed
@ScottMorris ScottMorris deleted the fix/issue-70-planner-audio-breakdown branch June 25, 2026 05:49

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3ae80c75ff

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

{formatBitrate(titleRate.bitsPerSecond)} video
</span>
)}
{titleRate != null && titleRate.audioBitsPerSecond > 0 && (

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Hide audio bitrate for titles without duration

When a title has no assigned asset or an unknown-duration asset and no audio mappings, the capacity estimator still returns an allocation and estimate_title_audio_bitrate_bps supplies the 192 kbps silent-audio fallback, while the same allocation has bitsPerSecond set to 0 for duration <= 0. With this condition, Planner renders 192 kbps audio beside No asset/0:00 rows even though that audio is not counted in the estimate and there is no media to break down; gate this on a real duration/asset or emit audioBitsPerSecond: 0 for zero-duration allocations.

Useful? React with 👍 / 👎.

ScottMorris added a commit that referenced this pull request Jun 25, 2026
…#102)

Codex follow-up to #101.

## Summary

Titles with no assigned asset (duration = 0) were getting
`audio_bits_per_second` set to the 192 kbps silent-fallback rate from
`estimate_title_audio_bitrate_bps`, causing the Planner to display "192
kbps audio" next to "No asset / 0:00" rows even though that audio is
never actually counted in the budget estimate.

Fix: gate `audio_bits_per_second` on `duration > 0`, matching the same
guard that already zeroes out `bits_per_second` for these rows in
`allocate_title_bitrates`.

## Test plan

- [ ] Title with no assigned asset → no audio stat shown in Planner
breakdown.
- [ ] Title with an assigned asset and audio mappings → audio stat still
appears correctly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01L3tSFK3P9vGwbNNtb4AYQG
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.

Planner does not break down audio/subtitle space allocation

1 participant