Skip to content

fix(playback): keep remote audio tracks in picker - #215

Merged
Quick104 merged 1 commit into
mainfrom
codex/fix-ios-playback-audio-inventory
Sep 1, 2026
Merged

Quick104 merged 1 commit into
mainfrom
codex/fix-ios-playback-audio-inventory

Conversation

@Quick104

@Quick104 Quick104 commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Protocol V3 remote playback can publish no selectable audio inventory through Aether even though the selected catalog file has multiple audio tracks. The Apple player replaced its picker state with that empty engine inventory, so the in-player Audio & Subtitles sheet omitted the Audio section.

Closes #214.

Solution

  • Preserve Aether as the authoritative inventory when it publishes audio tracks.
  • When Aether publishes none during a Protocol V3 session, project the selected catalog version's audio tracks into picker state.
  • Mark the active row from selected_tracks.audio.index and retain the server ordinal used by the existing audio_track_changed replan flow.
  • Keep catalog fallback rows picker-only so deferred local selection never sends a server ordinal to Aether as an engine track ID.

The server already accepts and preserves audio selection ordinals, so no server change is required.

Validation

  • PlaybackProtocolV3Tests: 43 passed, 0 failed, 0 skipped.
  • Studio-local iOS Simulator: build, install, and launch passed.
  • Studio-local tvOS Simulator: build, install, and launch passed.
  • Staged privacy leak check passed.
  • Required ponytail review: Lean already. Ship.

Risk

The fallback is deliberately narrow: it applies only when Aether publishes no audio tracks and both a Protocol V3 plan and selected catalog version are available. Original/offline and fully probed routes retain their existing engine inventory and local-selection behavior.

Visual evidence

Not attached because the preserved simulator contains private media metadata that should not be uploaded as public PR evidence. The focused regression tests cover the missing-inventory case, selected ordinal, stream-index mapping, server ordinal mapping, and engine-inventory precedence.

AI disclosure

OpenAI GPT-5 implemented and reviewed this change using the Codex desktop app. No additional AI model or agent harness was used. Local build and test validation used the repository's Mac builder workflow and Xcode.

Summary by CodeRabbit

  • New Features

    • Added fallback audio track selection from the catalog when no tracks are provided by Aether.
    • Preserved catalog audio metadata and ordering for playback selection.
  • Bug Fixes

    • Improved audio selection handling when Aether-provided inventory is available.
    • Ensured pending audio selections resolve consistently against the available track list.

Use the selected catalog version when a Protocol V3 route publishes no Aether audio inventory, while preserving Aether authority and local selection for routes that do publish tracks.

Fixes #214
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-01T14:14:15.308626Z 44143ae PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: a1c3abeb-ce03-49aa-aeb8-0b8feec3a8a3

📥 Commits

Reviewing files that changed from the base of the PR and between 5504d50 and 44143ae.

📒 Files selected for processing (3)
  • iosApp/Tests/PlaybackProtocolV3Tests.swift
  • iosApp/iosApp/Screens/Player/PlayerViewModel.swift
  • iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3PlanAdapter.swift

Included review availability: 2 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour.


📝 Walkthrough

Walkthrough

Protocol V3 audio picker publication now falls back to selected catalog audio tracks when Aether publishes no audio inventory. Non-empty Aether inventory remains authoritative. Pending selections continue to resolve against native Aether tracks.

Changes

Protocol V3 audio selection

Layer / File(s) Summary
Audio picker catalog fallback
iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3PlanAdapter.swift, iosApp/Tests/PlaybackProtocolV3Tests.swift
audioPickerTracks preserves non-empty Aether tracks and maps catalog tracks with metadata, ordinals, source IDs, FFmpeg indices, and selected state. Tests cover both fallback and authoritative Aether inventory.
Audio inventory adoption and selection
iosApp/iosApp/Screens/Player/PlayerViewModel.swift
The view model publishes projected picker tracks, uses their selected row for audio state, and matches pending selections against native Aether tracks.
Estimated code review effort: 3 (Moderate) ~20 minutes

Merge Risk: ⚪ Minimal · up to 44143

The localized audio-picker fallback is supported by focused regression coverage and validation, and no actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant Aether
  participant PlayerViewModel
  participant ApplePlaybackV3PlanAdapter
  participant Catalog
  Aether->>PlayerViewModel: Publish audio inventory
  PlayerViewModel->>ApplePlaybackV3PlanAdapter: Project picker tracks
  ApplePlaybackV3PlanAdapter->>Catalog: Read selected version audio tracks
  Catalog-->>ApplePlaybackV3PlanAdapter: Return catalog tracks
  ApplePlaybackV3PlanAdapter-->>PlayerViewModel: Return picker tracks
  PlayerViewModel->>Aether: Resolve pending selection against native tracks
Loading

Suggested reviewers: olivertgwalton

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the primary change: preserving remote Protocol V3 audio tracks in the picker.
Linked Issues check ✅ Passed The changes satisfy issue #214. They provide catalog-based fallback tracks when Aether publishes none, preserve Aether inventory when available, map the selected audio index, retain server ordinals fo…
Out of Scope Changes check ✅ Passed All changes are within scope for issue #214. They modify Protocol V3 picker mapping, playback inventory adoption, and focused regression tests without unrelated code changes.
Full details: Linked Issues check

Explanation

The changes satisfy issue #214. They provide catalog-based fallback tracks when Aether publishes none, preserve Aether inventory when available, map the selected audio index, retain server ordinals for replan handling, preserve engine-authoritative routes, and add focused regression tests.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-ios-playback-audio-inventory

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

@Quick104
Quick104 merged commit 901f7d6 into main Sep 1, 2026
1 check passed
@Quick104
Quick104 deleted the codex/fix-ios-playback-audio-inventory branch September 1, 2026 23:16
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.

iOS playback menu drops audio tracks on Protocol V3 routes

1 participant