Skip to content

[WIP] Replace MPV with Media3 playback protocol v3 - #67

Merged
Quick104 merged 23 commits into
mainfrom
codex/media3-playback-v3-wip
Jul 14, 2026
Merged

Quick104 merged 23 commits into
mainfrom
codex/media3-playback-v3-wip

Conversation

@Quick104

@Quick104 Quick104 commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

WIP status

This is an early review PR for the new Android playback stack. It is intentionally a draft and should not merge until the server v3 contract and real 4K Dolby Vision / HDR / AVR validation are complete.

Summary

  • Remove MPV and its runtime backend, fallback planner, manifests, dependencies, and source-policy tests.
  • Standardize phone and TV playback on AndroidX Media3.
  • Add the Playback Protocol v3 wire contract, capability reporting, deterministic attempt keys, start/replan flow, route diagnostics, and server-selected playback plans.
  • Add audio passthrough capability reporting and temporary passthrough suppression after decoder failures.
  • Update the bundled Media3 FFmpeg decoder AAR to 1.10.1 with AC-3, E-AC-3, TrueHD/MLP, and DTS decoding support.
  • Replace the legacy Media3 notes with the reviewed playback architecture, migration, compatibility, and implementation-status documentation under docs/playback/.

Validation completed

  • ./scripts/check-no-mpv-runtime.sh
  • :androidTvApp:assembleDebug
  • :androidApp:assembleDebug
  • Focused shared, phone, and TV playback tests documented in docs/playback/04-implementation-status-and-dv-handoff.md.
  • NVIDIA Shield smoke test against the dev v3 server: Media3 playback reached first frame and sustained 1080p H.264/AAC HLS playback with the NVIDIA hardware decoder.
  • Legacy server playback traffic remained healthy during the paired server rollout.

Remaining before ready

  • Validate direct-play 4K Dolby Vision and HDR signaling on a compatible television.
  • Validate E-AC-3/TrueHD/Atmos and DTS passthrough through a real AVR/eARC route.
  • Complete Kotlin/server attempt-key fixture parity and progressive-remux seek coverage.
  • Close remaining full-suite source-policy test failures recorded in the implementation-status document.
  • Land and version-gate the corresponding Silo server Playback Protocol v3 implementation.

Review focus

Please focus first on the v3 contract, capability claims, plan/replan lifecycle, MPV removal boundaries, and whether any client behavior could falsely claim direct play, HDR, Dolby Vision, or passthrough support.

Summary by CodeRabbit

  • New Features
    • Media3-only playback via server protocol v3, including in-session replans, seek re-anchoring, and enhanced recovery flows.
    • Playback quality selection supported from deep links (phone and TV).
    • Improved subtitle rendering with libass, including better embedded bitmap subtitle handling.
    • Dolby Vision/HDR10+ runtime corrections and stricter Dolby Vision profile support.
  • Bug Fixes
    • More robust stall classification and recovery for transport vs decoder “no output”, plus improved network interruption handling and auth refresh.
    • Smoother mid-stream audio/subtitle switching through consistent replanning.
  • Documentation
    • Updated playback docs and feature/version matrices; pinned Media3/FFmpeg versions and refreshed third-party notices.

@coderabbitai

coderabbitai Bot commented Jul 12, 2026 •

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ec5c4278-1be7-4d69-82db-9bf63d3f6639

📥 Commits

Reviewing files that changed from the base of the PR and between c180087 and 0edc910.

📒 Files selected for processing (5)
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/MobileVideoPlaybackStarter.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvVideoPlaybackStarter.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/playback/PlaybackSubtitleChoices.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/model/playback/PlaybackSubtitleChoicesTest.kt
💤 Files with no reviewable changes (3)
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvVideoPlaybackStarter.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/MobileVideoPlaybackStarter.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • shared/src/commonTest/kotlin/org/siloserver/silo/model/playback/PlaybackSubtitleChoicesTest.kt

📝 Walkthrough

Walkthrough

This PR migrates Android video playback to a single Media3 runtime with protocol-v3 server planning and replanning. It removes MPV execution paths, adds authentication, capability, Dolby Vision, libass, seek, recovery, deep-link, and validation infrastructure, and updates documentation and build tooling.

Changes

Media3-only playback migration

Layer / File(s) Summary
Protocol-v3 contracts and session APIs
shared/.../model/playback/*, shared/.../network/api/*, shared/.../repository/*, android-shared/.../PlaybackSessionManager.kt
Adds v3 plans, validation, replanning, route events, attempt keys, timeline semantics, session outcomes, and subtitle-choice models while removing older planning and audio-switch APIs.
Media3 runtime and transport
android-shared/.../player/*, android-shared/.../di/*, libass-bridge/*
Adds authenticated Media3 data sources, network evidence, bitrate-aware buffering, libass integration, scoped headers, custom renderers, and passthrough suppression.
Startup, replanning, and recovery
android-shared/.../player/*, androidApp/.../player/*, androidTvApp/.../player/*
Routes startup, track, quality, output-route, seek, and classified playback failures through protocol-v3 plans with bounded local retries.
Capability and Dolby Vision handling
android-shared/.../{DolbyVision*,PlaybackCapabilityDetector.kt}, android-shared/src/native/dovi/*
Adds codec/layout evidence, output-route generation, Dolby Vision transformations, HDR metadata repair, and HDR10+ sanitization.
Seek, stall, and UI behavior
android-shared/.../{seek/*,video/*}, androidApp/.../player/*, androidTvApp/.../player/*
Adds seek policies, presentation guards, quick skips, stall detectors, TV clean seeking, transport gating, quality deep links, and removes secondary subtitles and phone horizontal swipe seeking.
MPV removal and migration support
android-shared/.../{backend/*,mpv/*}, docs/playback/*, scripts/*, README.md
Removes MPV runtime and engine switching, updates dependencies and manifests, and adds Media3-only checks, migration documentation, notices, and native build tooling.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.11% which is insufficient. The required threshold is 80.00%. 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 matches the main change: replacing MPV with a Media3-based playback protocol v3 implementation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/media3-playback-v3-wip

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

@Quick104

Copy link
Copy Markdown
Contributor Author

Code review

Found 1 issue:

  1. The PR deletes the entire docs/media3/ directory (replaced by the new docs/playback/) and updates README.md accordingly, but leaves the repository guidelines pointing at the removed directory (CLAUDE.md — a symlink to AGENTS.md — says "Android playback notes live in docs/media3/; utility scripts live in scripts/."). After merge, the guidelines will direct contributors to a directory that no longer exists; the sentence should point at docs/playback/.

This repository contains only the Silo Android clients. Shared Kotlin logic lives in `shared/`, Android-only playback and UI helpers live in `android-shared/`, the phone app lives in `androidApp/`, and the TV app lives in `androidTvApp/`. Android playback notes live in `docs/media3/`; utility scripts live in `scripts/`.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@coderabbitai coderabbitai 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.

Actionable comments posted: 11

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/MediaAuthInterceptor.kt (1)

36-62: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Bound the media refresh call, not the snapshot reads

authSession.snapshot() is just mutex-protected state access, but refreshIfStale() still runs a real OkHttp refresh on the interceptor thread. The injected player-refresh-okhttp client is a plain OkHttpClient() in PlayerModule, so a slow or hung refresh can stall playback 401 handling. Give the refresh client an explicit timeout budget, or move the refresh off the interceptor thread.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/MediaAuthInterceptor.kt`
around lines 36 - 62, Bound the refresh operation used by MediaAuthInterceptor
without adding timeouts to the mutex-protected snapshot reads. Configure the
injected player-refresh-okhttp client in PlayerModule with explicit connect,
read, and call timeouts, or move refreshIfStale off the interceptor thread while
preserving its single-flight behavior and retry flow.
🧹 Nitpick comments (13)
shared/src/commonMain/kotlin/org/siloserver/silo/repository/PlaybackRepository.kt (1)

21-30: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Add KDoc to the new V3 methods for consistency.

Every other public method in this class (startPlayback, updateProgress, stopPlayback, startTranscode) has a doc comment; the new startPlaybackV3/replanPlaybackV3/reportRouteEventV3 methods don't.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@shared/src/commonMain/kotlin/org/siloserver/silo/repository/PlaybackRepository.kt`
around lines 21 - 30, Add KDoc comments to the public methods startPlaybackV3,
replanPlaybackV3, and reportRouteEventV3 in PlaybackRepository, matching the
existing documentation style used by startPlayback, updateProgress,
stopPlayback, and startTranscode. Document each method’s purpose and parameters
without changing their behavior.
android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/audio/PassthroughSuppressionRegistryTest.kt (1)

27-36: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Text-matching the production source instead of testing behavior.

This test reads a sibling .kt file via a hardcoded relative path and substring-matches its contents, rather than exercising AudioSink/renderer behavior. It's fragile to source reformatting and to the test's working directory, and it can pass even if the actual runtime behavior regresses (as long as the token strings remain present).

Consider replacing this with a behavioral test that constructs/mocks an AudioSink (or the renderer that wraps it) and asserts the actual SINK_FORMAT_* value returned when PassthroughSuppressionRegistry.isSuppressed(format) is true.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/audio/PassthroughSuppressionRegistryTest.kt`
around lines 27 - 36, The test
suppressingSinkMarksEncodedFormatUnsupportedToForcePcmDecode currently inspects
production source text instead of runtime behavior. Replace the hardcoded file
reading and substring assertions with a behavioral test that exercises the
relevant AudioSink or renderer path using a suppressed format, then assert it
returns AudioSink.SINK_FORMAT_UNSUPPORTED and not
SINK_FORMAT_SUPPORTED_WITH_TRANSCODING.
android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/AudioCapabilityManager.kt (2)

138-147: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicated codec/min-SDK gating between mapCapabilities and probePassthroughEntries.

The (codec name, encoding, minSdk) mapping for dts_hd, truehd, and ac4 is written out twice — once to build codecs, once in encodingsToProbe. A future SDK-guard change applied to only one site would silently desync the two lists.

Consider extracting a single data class EncodingSupport(val codec: String, val encoding: Int, val minSdk: Int) list used by both codecs construction and encodingsToProbe.

Also applies to: 242-253

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/AudioCapabilityManager.kt`
around lines 138 - 147, Extract the shared codec, encoding, and minimum-SDK
metadata for dts_hd, truehd, and ac4 into a single EncodingSupport data
class/list. Update both mapCapabilities and probePassthroughEntries to derive
codecs and encodingsToProbe from that shared list while preserving the existing
SDK guards and outputs.

150-158: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Fallback to 2 on Q+ can under-report real channel capacity.

Pre-Q falls back to caps.maxChannelCount.coerceAtLeast(2) when direct probing is unavailable, but on Q+ an empty entries list (e.g., because none of the 3 fixed candidate layouts matched a codec the sink genuinely supports at a different channel count) silently collapses maxChannels to 2. This can under-report passthrough capability to the server and degrade the selected route even though caps.maxChannelCount may still carry a useful signal.

♻️ Proposed fix: keep the Media3 value as a floor instead of a hardcoded 2
         val maxChannels = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
-            entries.flatMap(AudioPassthroughEntry::channelCounts).maxOrNull() ?: 2
+            entries.flatMap(AudioPassthroughEntry::channelCounts).maxOrNull()
+                ?: caps.maxChannelCount.coerceAtLeast(2)
         } else {
             caps.maxChannelCount.coerceAtLeast(2)
         }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/AudioCapabilityManager.kt`
around lines 150 - 158, Update the Q+ fallback in the maxChannels calculation
near probePassthroughEntries so an empty entries result uses
caps.maxChannelCount.coerceAtLeast(2), matching the pre-Q behavior, rather than
defaulting directly to 2. Preserve the probed channel maximum when entries are
available.
shared/src/commonMain/kotlin/org/siloserver/silo/model/playback/PlaybackProtocolV3.kt (1)

79-98: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Descriptor doesn't reflect the serializer's nullable type parameter.

TolerantPlaybackPlanV3Serializer implements KSerializer<PlaybackPlanV3?> but exposes delegate.descriptor (non-nullable) rather than delegate.descriptor.nullable. Actual serialize/deserialize already handle null explicitly, so JSON round-tripping is unaffected, but the descriptor's isNullable metadata is technically inconsistent with the serializer's declared nullable type — worth aligning for correctness with formats/tools that inspect the descriptor.

♻️ Suggested fix
 internal object TolerantPlaybackPlanV3Serializer : KSerializer<PlaybackPlanV3?> {
     private val delegate = PlaybackPlanV3.serializer()
-    override val descriptor: SerialDescriptor = delegate.descriptor
+    override val descriptor: SerialDescriptor = delegate.descriptor.nullable
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@shared/src/commonMain/kotlin/org/siloserver/silo/model/playback/PlaybackProtocolV3.kt`
around lines 79 - 98, Update TolerantPlaybackPlanV3Serializer.descriptor to
expose the delegate descriptor as nullable, matching its
KSerializer<PlaybackPlanV3?> type and the existing null handling in serialize
and deserialize.
android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/AuthenticatedDataSourceFactory.kt (1)

181-198: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

requestHeadersProvider invoked for every scheme, including local file/content URIs.

Headers are computed and potentially merged into the DataSpec even when the resolved URI routes to file/content downstream sources that never read httpRequestHeaders. Scoping the call to http(s) schemes avoids unnecessary provider invocations and stray header injection on local playback paths.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/AuthenticatedDataSourceFactory.kt`
around lines 181 - 198, Update resolveDataSpec to invoke requestHeadersProvider
only when resolved.uri uses an HTTP or HTTPS scheme. Return the resolved
DataSpec unchanged for file, content, and other non-network schemes, while
preserving the existing header merge behavior for HTTP(S) URIs.
libass-bridge/build.gradle.kts (1)

30-30: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use version catalog for JUnit like the other dependencies.

Every other dependency here resolves through libs.*; hardcoding "junit:junit:4.13.2" breaks that consistency and bypasses centralized version management.

♻️ Suggested fix
-    testImplementation("junit:junit:4.13.2")
+    testImplementation(libs.junit)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libass-bridge/build.gradle.kts` at line 30, Update the test dependency
declaration in the Gradle configuration to use the existing version-catalog
JUnit alias via libs.* instead of the hardcoded junit:junit:4.13.2 coordinate,
matching the style of the surrounding dependencies.
androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerScreenStartPositionTest.kt (1)

125-129: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Unscoped substring checks don't actually verify "watchdog re-arm on transport reopen."

Unlike the sibling test above it (which scopes assertions to mountEffect via substringAfter/substringBefore), this test only checks that two literal strings exist anywhere in TvPlayerScreen.kt. It would pass even if the two snippets are unrelated and never used together to rearm anything, so it doesn't meaningfully guard the described behavior.

♻️ Scope the check like the neighboring test
     `@Test`
     fun transportReopenRearmsSharedWatchdog() {
-        assertTrue(source.contains("state.playbackPlan?.decisionTrace?.size"))
-        assertTrue(source.contains("plan?.decisionTrace?.size ?: 0"))
+        val transportReopenBlock = source
+            .substringAfter("/* transport reopen */") // or the actual marker/function name
+            .substringBefore("/* end transport reopen */")
+        assertTrue(transportReopenBlock.contains("state.playbackPlan?.decisionTrace?.size"))
+        assertTrue(transportReopenBlock.contains("plan?.decisionTrace?.size ?: 0"))
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerScreenStartPositionTest.kt`
around lines 125 - 129, Update transportReopenRearmsSharedWatchdog to scope its
source assertions to the relevant transport-reopen/watchdog block, following the
neighboring test’s substringAfter/substringBefore pattern. Verify both
decisionTrace expressions occur within that scoped block and remain part of the
same re-arm logic, rather than matching anywhere in TvPlayerScreen.kt.
android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackV3Session.kt (1)

86-89: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Prefer exhaustive when over .name string comparison for stream.protocol.

Line 87 compares stream.protocol.name to the literal "HLS" instead of matching the enum value directly. Unlike the PlaybackDelivery mapping just above (Lines 41-48), which the compiler forces to stay exhaustive, this string comparison silently classifies any future/unhandled PlaybackStreamProtocol value as "progressive" without any compile-time warning.

♻️ Suggested fix
-        stream = PlaybackStreamRequest(
-            url = stream.url,
-            streamType = if (stream.protocol.name == "HLS") "hls" else "progressive",
-            playMethod = playMethod,
-        ),
+        stream = PlaybackStreamRequest(
+            url = stream.url,
+            streamType = when (stream.protocol) {
+                PlaybackStreamProtocol.HLS -> "hls"
+                PlaybackStreamProtocol.HTTP_PROGRESSIVE -> "progressive"
+            },
+            playMethod = playMethod,
+        ),
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackV3Session.kt`
around lines 86 - 89, Replace the streamType conditional in the
PlaybackV3Session playback request with an exhaustive when over stream.protocol,
mapping the HLS enum value to "hls" and explicitly mapping the remaining
supported protocol value to "progressive". Avoid comparing protocol.name so
future enum values trigger compile-time handling.
shared/src/commonTest/kotlin/org/siloserver/silo/network/api/PlaybackApiTest.kt (1)

122-122: 📐 Maintainability & Code Quality | 🔵 Trivial

Prefer jsonPrimitive.boolean over manual content.toBoolean().

kotlinx-serialization-json provides JsonPrimitive.boolean for this exact conversion, matching the .int usage already used elsewhere in this test.
[optional_refactor_low_effort]

♻️ Proposed fix
-        assertEquals(true, body["metered"]!!.jsonPrimitive.content.toBoolean())
+        assertEquals(true, body["metered"]!!.jsonPrimitive.boolean)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@shared/src/commonTest/kotlin/org/siloserver/silo/network/api/PlaybackApiTest.kt`
at line 122, Update the metered assertion in PlaybackApiTest to use
JsonPrimitive.boolean instead of manually converting jsonPrimitive.content with
toBoolean(), matching the existing JsonPrimitive.int style used elsewhere in the
test.
android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/PlaybackBufferPolicyTest.kt (1)

52-60: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Test name vs. new assertion direction may be inconsistent.

The assertion flipped from a "less than" to a "greater than or equal to" check against Balanced.bufferForPlaybackMs, and with the new constants (Smooth=5000ms > Balanced=3000ms) SmoothPlayback now requires more initial buffering than Balanced before playback starts — the opposite of what ...StartsQuickly... implies relative to Balanced. Please confirm this retune (favoring fewer rebuffers over startup speed) is intentional, and consider renaming the test if so.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/PlaybackBufferPolicyTest.kt`
around lines 52 - 60, Confirm the SmoothPlayback tuning in
smoothPlaybackStartsQuicklyThenGrowsADeepForwardBuffer: if its initial buffer is
intentionally greater than Balanced’s, rename the test to describe deeper
buffering and rebuffers rather than quick startup; otherwise restore the
assertion and constants so SmoothPlayback starts with less buffering than
Balanced.
android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/MediaAuthInterceptor.kt (1)

27-34: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Avoid a default throwaway OkHttpClient() for refresh.

Each OkHttpClient() instance owns its own dispatcher/connection pool. If this secondary constructor is invoked more than once (e.g. per player session), it needlessly multiplies thread pools. Prefer requiring callers to pass a shared client instance.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/MediaAuthInterceptor.kt`
around lines 27 - 34, Remove the default OkHttpClient() value from the secondary
MediaAuthInterceptor constructor and require callers to provide a shared
refreshClient explicitly. Keep the existing MediaAuthSession wiring and other
constructor defaults unchanged.
android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/MediaAuthSession.kt (1)

24-27: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Avoid a fresh OkHttpClient() per default parameter.

The default value OkHttpClient() allocates a new client (its own dispatcher/connection pool) whenever this constructor is invoked without an explicit refreshClient. Prefer wiring the app-wide shared OkHttpClient instance (already used elsewhere per PlayerOkHttpClient.kt) so refresh requests reuse the existing connection pool instead of spinning up a parallel one.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/MediaAuthSession.kt`
around lines 24 - 27, The MediaAuthSession constructor currently creates a
separate OkHttpClient when refreshClient is omitted. Replace that default with
the app-wide shared client used by PlayerOkHttpClient.kt, while preserving the
ability to inject an explicit refreshClient.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.gitignore:
- Line 57: Remove the blanket docs/ entry from .gitignore so documentation under
docs/playback/ and docs/superpowers/ is tracked normally, including future
additions and changes.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/AuthenticatedDataSourceFactory.kt`:
- Around line 71-86: Update AuthenticatedDataSourceFactory.open so the 401
handling bounds the synchronous authSession.refreshIfStale call with the
established local timeout mechanism before creating and opening the retry data
source. Preserve the existing retry behavior when refresh completes
successfully, and rethrow the original InvalidResponseCodeException when refresh
times out or fails.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackCapabilityDetector.kt`:
- Around line 404-407: The isDirectPlayableDolbyVisionProfile function must
restore Profile 8 fallback behavior: return true when the profile is 8 and the
device supports the HDR10/HLG base layer, even if dolbyVisionProfiles excludes
it. Preserve the existing Dolby Vision profile check for all other profiles and
reuse the existing base-layer capability symbols.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackNetworkMonitor.kt`:
- Around line 75-79: Synchronize the `onBandwidthSample` method using the same
monitor lock as `refresh` so validation, `measuredBitrateBps` assignment, and
`publish` execute atomically with network switching. Preserve the existing input
guards and publication behavior while preventing a stale sample from being
applied after `refresh` clears the estimate.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackSessionManager.kt`:
- Around line 67-69: Unify synchronization for activeVideoAttempt by using
videoAttemptMutex for every read and write across startVideoSessionV3,
stopSession, replanActiveVideoSession, and the reporter methods such as
reportFirstVideoFrame; remove or avoid the separate `@Synchronized` protection so
all accesses coordinate through the same guard and stale reporter updates cannot
overwrite newer state.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlayerStatsSnapshot.kt`:
- Around line 56-57: Update the videoWidth and videoHeight assignments in the
PlayerStatsSnapshot copy flow to retain current.videoWidth and
current.videoHeight when the incoming format dimensions are not positive.
Preserve the new positive dimensions while matching the existing fallback
behavior used by resolution and the other diagnostic fields.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/SubtitleManager.kt`:
- Around line 742-761: Update subtitleCodecFamily so SubRip detection also
recognizes normalized values ending with “srt”, while preserving the existing
subrip match and all other codec-family branches.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/PlaybackStartupStallDetector.kt`:
- Around line 107-119: Update the progress handling in
PlaybackStartupStallDetector so bufferedPositionMs growth refreshes
lastProgressAtMs only before firstFrameRendered, not after playback has started.
For the post-first-frame path, refresh the heartbeat solely from actual
decoder/render output progress, while preserving backward-buffer handling and
the existing startup transport-progress behavior.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/PostResumeVideoStallDetector.kt`:
- Around line 46-62: Update PostResumeVideoStallDetector.onIsPlayingChanged so
pausing during any active recovery stage resets or re-anchors stageStartedAtMs
and baselinePositionMs when playback resumes, preventing paused time from
contributing to stall detection. Preserve the existing pausedAfterFirstFrame
behavior for Stage.IDLE and ensure resumed recovery continues from the current
playback position and timestamp.

In `@scripts/check-no-mpv-runtime.sh`:
- Around line 7-15: Add shared/src/commonMain to the ripgrep runtime scan in the
script’s runtime_hits command, while preserving the existing exclusion filter
for PlaybackModels.kt and PlaybackProtocolV3.kt so those known references remain
ignored.

In
`@shared/src/commonMain/kotlin/org/siloserver/silo/model/playback/PlaybackProtocolV3.kt`:
- Around line 376-389: Update the unsupported runtime-correction branch in the
playback validation flow to include the rejected correction’s identifier in the
ReplanRequired reason, matching the diagnostic detail provided by the sibling
unsupportedClientTransform branch. Use the existing unsupportedRuntimeCorrection
value when constructing the reason and preserve the current plan and
resolvedSessionId arguments.

---

Outside diff comments:
In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/MediaAuthInterceptor.kt`:
- Around line 36-62: Bound the refresh operation used by MediaAuthInterceptor
without adding timeouts to the mutex-protected snapshot reads. Configure the
injected player-refresh-okhttp client in PlayerModule with explicit connect,
read, and call timeouts, or move refreshIfStale off the interceptor thread while
preserving its single-flight behavior and retry flow.

---

Nitpick comments:
In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/AudioCapabilityManager.kt`:
- Around line 138-147: Extract the shared codec, encoding, and minimum-SDK
metadata for dts_hd, truehd, and ac4 into a single EncodingSupport data
class/list. Update both mapCapabilities and probePassthroughEntries to derive
codecs and encodingsToProbe from that shared list while preserving the existing
SDK guards and outputs.
- Around line 150-158: Update the Q+ fallback in the maxChannels calculation
near probePassthroughEntries so an empty entries result uses
caps.maxChannelCount.coerceAtLeast(2), matching the pre-Q behavior, rather than
defaulting directly to 2. Preserve the probed channel maximum when entries are
available.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/AuthenticatedDataSourceFactory.kt`:
- Around line 181-198: Update resolveDataSpec to invoke requestHeadersProvider
only when resolved.uri uses an HTTP or HTTPS scheme. Return the resolved
DataSpec unchanged for file, content, and other non-network schemes, while
preserving the existing header merge behavior for HTTP(S) URIs.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/MediaAuthInterceptor.kt`:
- Around line 27-34: Remove the default OkHttpClient() value from the secondary
MediaAuthInterceptor constructor and require callers to provide a shared
refreshClient explicitly. Keep the existing MediaAuthSession wiring and other
constructor defaults unchanged.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/MediaAuthSession.kt`:
- Around line 24-27: The MediaAuthSession constructor currently creates a
separate OkHttpClient when refreshClient is omitted. Replace that default with
the app-wide shared client used by PlayerOkHttpClient.kt, while preserving the
ability to inject an explicit refreshClient.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackV3Session.kt`:
- Around line 86-89: Replace the streamType conditional in the PlaybackV3Session
playback request with an exhaustive when over stream.protocol, mapping the HLS
enum value to "hls" and explicitly mapping the remaining supported protocol
value to "progressive". Avoid comparing protocol.name so future enum values
trigger compile-time handling.

In
`@android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/audio/PassthroughSuppressionRegistryTest.kt`:
- Around line 27-36: The test
suppressingSinkMarksEncodedFormatUnsupportedToForcePcmDecode currently inspects
production source text instead of runtime behavior. Replace the hardcoded file
reading and substring assertions with a behavioral test that exercises the
relevant AudioSink or renderer path using a suppressed format, then assert it
returns AudioSink.SINK_FORMAT_UNSUPPORTED and not
SINK_FORMAT_SUPPORTED_WITH_TRANSCODING.

In
`@android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/PlaybackBufferPolicyTest.kt`:
- Around line 52-60: Confirm the SmoothPlayback tuning in
smoothPlaybackStartsQuicklyThenGrowsADeepForwardBuffer: if its initial buffer is
intentionally greater than Balanced’s, rename the test to describe deeper
buffering and rebuffers rather than quick startup; otherwise restore the
assertion and constants so SmoothPlayback starts with less buffering than
Balanced.

In
`@androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerScreenStartPositionTest.kt`:
- Around line 125-129: Update transportReopenRearmsSharedWatchdog to scope its
source assertions to the relevant transport-reopen/watchdog block, following the
neighboring test’s substringAfter/substringBefore pattern. Verify both
decisionTrace expressions occur within that scoped block and remain part of the
same re-arm logic, rather than matching anywhere in TvPlayerScreen.kt.

In `@libass-bridge/build.gradle.kts`:
- Line 30: Update the test dependency declaration in the Gradle configuration to
use the existing version-catalog JUnit alias via libs.* instead of the hardcoded
junit:junit:4.13.2 coordinate, matching the style of the surrounding
dependencies.

In
`@shared/src/commonMain/kotlin/org/siloserver/silo/model/playback/PlaybackProtocolV3.kt`:
- Around line 79-98: Update TolerantPlaybackPlanV3Serializer.descriptor to
expose the delegate descriptor as nullable, matching its
KSerializer<PlaybackPlanV3?> type and the existing null handling in serialize
and deserialize.

In
`@shared/src/commonMain/kotlin/org/siloserver/silo/repository/PlaybackRepository.kt`:
- Around line 21-30: Add KDoc comments to the public methods startPlaybackV3,
replanPlaybackV3, and reportRouteEventV3 in PlaybackRepository, matching the
existing documentation style used by startPlayback, updateProgress,
stopPlayback, and startTranscode. Document each method’s purpose and parameters
without changing their behavior.

In
`@shared/src/commonTest/kotlin/org/siloserver/silo/network/api/PlaybackApiTest.kt`:
- Line 122: Update the metered assertion in PlaybackApiTest to use
JsonPrimitive.boolean instead of manually converting jsonPrimitive.content with
toBoolean(), matching the existing JsonPrimitive.int style used elsewhere in the
test.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fae5f4cf-9875-42af-93f3-0f87b08655c7

📥 Commits

Reviewing files that changed from the base of the PR and between 6defbcf and e25d52e.

📒 Files selected for processing (184)
  • .gitignore
  • FEATURES.md
  • README.md
  • THIRD_PARTY_NOTICES.md
  • android-shared/build.gradle.kts
  • android-shared/libs/media3-decoder-ffmpeg-1.10.0.aar
  • android-shared/libs/media3-decoder-ffmpeg-1.10.1.aar
  • android-shared/libs/silo-dovi-bridge-2.3.1.aar
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/di/PlayerInfraModule.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/di/PlayerModule.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/ActivePlayerHolder.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/AudioCapabilityManager.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/AuthenticatedDataSourceFactory.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/DolbyVisionColorInfoExtractorsFactory.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/DolbyVisionProfile7Transformer.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/FfmpegAudioSupport.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/MediaAuthInterceptor.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/MediaAuthSession.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/MediaCodecCapabilitiesProbe.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/Playability.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackAnalyticsListener.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackBufferPolicy.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackCapabilityDetector.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackNetworkMonitor.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackRecoveryPlanner.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackSessionLifecycle.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackSessionManager.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackV3Session.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlayerOkHttpClient.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlayerStatsSnapshot.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/SiloLoadControl.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/SiloPlaybackService.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/SiloPlayerFactory.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/SubtitleManager.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/VideoPlayerMediaMounter.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/VideoPlayerMediaSpec.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/audio/PassthroughSuppressionRegistry.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/MpvDeviceFloor.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/MpvVideoPlaybackBackend.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/PlaybackBackendFallback.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/PlaybackEngineCommand.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/PlaybackEngineDecision.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/VideoBackendCapabilities.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/VideoPlaybackBackend.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/VideoPlaybackBackendFactory.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/VideoPlaybackBackendKind.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/VideoPlaybackBackendPreference.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/VideoPlaybackBackendRequest.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/VideoPlaybackBackendSelector.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/VideoPlaybackFormFactor.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/mpv/MpvPlayer.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/mpv/MpvSubtitleStyle.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/mpv/MpvTrackType.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/mpv/MpvVideoScaleMode.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/route/PlaybackRoute.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/route/RouteCapabilityMatrix.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/subtitle/OffsetSubtitleParserFactory.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/DolbyVisionHdr10PlusSanitizer.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/ImmediateServerFallbackPolicy.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/MpvSoftwareVideoCodecs.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/OriginalPlaybackRequestPolicy.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/PlaybackContainerPolicy.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/PlaybackRuntimeCorrectionState.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/PlaybackStartupStallDetector.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/PostResumeVideoStallDetector.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/SiloMediaCodecVideoRenderer.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/VideoPlaybackSessionCoordinator.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/VideoPlaybackStartRequest.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/VideoPlaybackStartResult.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/VideoPlayerRouteArgs.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/VideoPlayerUiState.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/DolbyVisionColorInfoExtractorsFactoryTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/DolbyVisionProfile7TransformerTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/FfmpegClasspathTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/Media3OnlyRuntimeSourceTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/MediaAuthSessionTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/MediaCodecCapabilitiesProbeTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/PlaybackBufferPolicyTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/PlaybackCapabilityDetectorDolbyVisionTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/PlaybackCapabilityDetectorSourceTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/PlaybackRecoveryPlannerTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/PlaybackV3SessionTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/PlayerStatsSnapshotReducerTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/SiloPlaybackServiceEngineSourceTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/SiloPlaybackServiceMpvSourceTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/SiloPlaybackServiceSubtitleSyncSourceTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/SiloPlayerFactoryMpvAuthSourceTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/SiloPlayerFactorySubtitleParserTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/StyledSubtitleBurnInTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/SubtitleManagerTrackSelectionTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/audio/PassthroughSuppressionRegistryTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/backend/MpvDeviceFloorTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/backend/MpvSoftwareVideoCodecPolicyTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/backend/MpvVideoPlaybackBackendSourceTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/backend/PlaybackBackendFallbackTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/backend/PlaybackEngineCommandTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/backend/PlaybackEngineDecisionTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/backend/VideoBackendCapabilitiesBrandingTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/backend/VideoBackendCapabilitiesTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/backend/VideoPlaybackBackendFactorySourceTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/backend/VideoPlaybackBackendSelectorTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/mpv/MpvPlayerSourceTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/mpv/MpvSubtitleStyleTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/route/RouteCapabilityMatrixTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/video/DolbyVisionHdr10PlusSanitizerTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/video/OriginalPlaybackRequestPolicyTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/video/PlaybackContainerPolicyTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/video/PlaybackRuntimeCorrectionStateTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/video/PlaybackStartupStallDetectorTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/video/PostResumeVideoStallDetectorTest.kt
  • android-shared/src/native/dovi/THIRD_PARTY_NOTICES.txt
  • android-shared/src/native/dovi/silo_dovi.cpp
  • androidApp/build.gradle.kts
  • androidApp/src/androidMain/AndroidManifest.xml
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/di/AndroidModule.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/navigation/AppNavigation.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/navigation/ContentDeepLinkRoutes.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/navigation/Routes.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/MobileSubtitleAutoSelection.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/MobileVideoPlaybackStarter.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerOverlay.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerScreen.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerSettingsSheet.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModel.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/TracksSheet.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/AndroidManifestPolicyTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/pip/MobilePictureInPictureSourceTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/player/AndroidMpvManifestSourceTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/navigation/ContentDeepLinkRoutesTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/navigation/PlayerRouteTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/MobileSubtitleAutoSelectionTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerScreenStartPositionTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModelSharedCoordinatorTest.kt
  • androidTvApp/src/androidMain/AndroidManifest.xml
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/di/AndroidTvModule.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/navigation/TvAppNavigation.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/navigation/TvAudiobookRouting.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/navigation/TvRoute.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerHud.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvVideoPlaybackStarter.kt
  • androidTvApp/src/androidMain/res/layout/tv_player_view.xml
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/TvAndroidManifestPolicyTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/player/AndroidTvMpvManifestSourceTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/navigation/TvAudiobookRoutingTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/PlayerTrackEntriesTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerControlsUsabilityTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerEngineRequestHelpersTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerScreenStartPositionTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerUsabilityTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModelSharedCoordinatorTest.kt
  • docs/media3/01-overview-and-setup.md
  • docs/media3/02-mkv-container-support.md
  • docs/media3/03-hdr-and-dolby-vision.md
  • docs/media3/04-atmos-and-audio-codecs.md
  • docs/media3/05-passthrough-tunneling-offload.md
  • docs/media3/06-android-tv-and-track-selection.md
  • docs/media3/07-current-implementation-review.md
  • docs/media3/08-implementation-guide.md
  • docs/media3/09-direct-play-route-planning-spec.md
  • docs/media3/10-reference-player-comparison.md
  • docs/media3/README.md
  • docs/playback/01-media3-only-player-architecture.md
  • docs/playback/02-migration-compatibility-validation.md
  • docs/playback/03-reference-implementation-review.md
  • docs/playback/04-implementation-status-and-dv-handoff.md
  • docs/playback/README.md
  • gradle/libs.versions.toml
  • libass-bridge/build.gradle.kts
  • libass-bridge/src/main/java/org/siloserver/silo/libass/LibassBridge.java
  • libass-bridge/src/test/java/org/siloserver/silo/libass/LibassBridgeTimeTest.java
  • proguard-rules.pro
  • scripts/README-ffmpeg-aar.md
  • scripts/build-dovi-aar.sh
  • scripts/build-ffmpeg-aar.sh
  • scripts/check-no-mpv-runtime.sh
  • settings.gradle.kts
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/playback/PlaybackModels.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/playback/PlaybackProtocolV3.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/api/PlaybackApi.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/repository/PlaybackRepository.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/model/playback/PlaybackProtocolV3Test.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/network/api/PlaybackApiTest.kt
💤 Files with no reviewable changes (48)
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/SiloPlaybackServiceEngineSourceTest.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/MpvSoftwareVideoCodecs.kt
  • androidTvApp/src/androidMain/AndroidManifest.xml
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/VideoPlaybackBackendPreference.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/PlaybackEngineCommand.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerEngineRequestHelpersTest.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/mpv/MpvVideoScaleMode.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/ImmediateServerFallbackPolicy.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/ActivePlayerHolder.kt
  • docs/media3/02-mkv-container-support.md
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/PlaybackBackendFallback.kt
  • docs/media3/03-hdr-and-dolby-vision.md
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/SiloPlaybackServiceMpvSourceTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/backend/PlaybackEngineCommandTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/backend/PlaybackBackendFallbackTest.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/mpv/MpvTrackType.kt
  • docs/media3/05-passthrough-tunneling-offload.md
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/MpvDeviceFloor.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/pip/MobilePictureInPictureSourceTest.kt
  • docs/media3/07-current-implementation-review.md
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/player/AndroidMpvManifestSourceTest.kt
  • docs/media3/01-overview-and-setup.md
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/di/PlayerInfraModule.kt
  • docs/media3/04-atmos-and-audio-codecs.md
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/OriginalPlaybackRequestPolicy.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/backend/MpvSoftwareVideoCodecPolicyTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/player/AndroidTvMpvManifestSourceTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/mpv/MpvSubtitleStyleTest.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/MpvVideoPlaybackBackend.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/SiloPlayerFactoryMpvAuthSourceTest.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/VideoPlaybackFormFactor.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/backend/PlaybackEngineDecisionTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/backend/MpvVideoPlaybackBackendSourceTest.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/PlaybackEngineDecision.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/TracksSheet.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackRecoveryPlanner.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/PlaybackRecoveryPlannerTest.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/VideoPlaybackBackendKind.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/mpv/MpvPlayer.kt
  • androidApp/src/androidMain/AndroidManifest.xml
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/VideoPlaybackBackend.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/mpv/MpvSubtitleStyle.kt
  • docs/media3/06-android-tv-and-track-selection.md
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/mpv/MpvPlayerSourceTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/video/OriginalPlaybackRequestPolicyTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/backend/VideoBackendCapabilitiesTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/backend/VideoPlaybackBackendSelectorTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/backend/MpvDeviceFloorTest.kt
👮 Files not reviewed due to content moderation or server errors (2)
  • android-shared/libs/media3-decoder-ffmpeg-1.10.1.aar
  • android-shared/libs/silo-dovi-bridge-2.3.1.aar

Comment thread .gitignore Resolved
Comment thread scripts/check-no-mpv-runtime.sh Resolved
@Quick104
Quick104 marked this pull request as ready for review July 13, 2026 23:12

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerOverlay.kt`:
- Around line 106-111: Update the in-room branch of gatedSkipForward to only
apply coerceAtMost(state.duration) when state.duration is greater than 0.0;
otherwise use the calculated forward position unchanged, matching the
performRelativeSeek behavior while preserving the existing seekEnabled and
non-room paths.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ad0a8e4f-f51b-4e9c-a8d5-6d06bd2c62e6

📥 Commits

Reviewing files that changed from the base of the PR and between e25d52e and 4c972c7.

📒 Files selected for processing (36)
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackSessionManager.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackV3Session.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/seek/Media3SeekRecoveryPolicy.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/seek/PendingSeekPresentationGuard.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/seek/PlaybackTimelineSeekPolicy.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/seek/QuickSkipAccumulator.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/VideoPlaybackSessionCoordinator.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/VideoPlaybackStartResult.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/VideoPlayerUiState.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/PlaybackSessionManagerSeekReanchorTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/PlaybackV3SessionTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/seek/Media3SeekRecoveryPolicyTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/seek/PendingSeekPresentationGuardTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/seek/PlaybackTimelineSeekPolicyTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/seek/QuickSkipAccumulatorTest.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/MobileVideoPlaybackStarter.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerGestureHandler.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerOverlay.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerScreen.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModel.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerScreenStartPositionTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModelSharedCoordinatorTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModelStartPositionTest.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvSeekRecoveryQueue.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvVideoPlaybackStarter.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvCleanPlaybackSeekTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerControlsUsabilityTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerScreenStartPositionTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModelSharedCoordinatorTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvSeekRecoveryQueueTest.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/playback/PlaybackModels.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/playback/PlaybackProtocolV3.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/model/playback/PlaybackProtocolV3Test.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/network/api/PlaybackApiTest.kt
🚧 Files skipped from review as they are similar to previous changes (16)
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/VideoPlaybackSessionCoordinator.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/VideoPlaybackStartResult.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/VideoPlayerUiState.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackV3Session.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerScreenStartPositionTest.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/MobileVideoPlaybackStarter.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModelSharedCoordinatorTest.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/model/playback/PlaybackProtocolV3Test.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvVideoPlaybackStarter.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/playback/PlaybackProtocolV3.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/network/api/PlaybackApiTest.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerScreen.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/playback/PlaybackModels.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackSessionManager.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModel.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt

@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: 4c972c70be

ℹ️ 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".

@coderabbitai coderabbitai 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/PlaybackStartupStallDetector.kt (1)

79-97: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Reset decoderStartupAtMs when playback is paused

Pausing while the decoder-startup deadline is armed leaves decoderStartupAtMs intact, so a later resume counts the paused interval toward decoder_no_output / render_startup_failure and can fire immediately. Clear or re-anchor this timer when playWhenReady is false, like the resume stall detector does.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/PlaybackStartupStallDetector.kt`
around lines 79 - 97, Reset or re-anchor decoderStartupAtMs whenever
playWhenReady is false in the playback startup stall detection flow. Ensure a
later resume starts a fresh decoder startup grace period rather than counting
paused time, while preserving the existing decoder_no_output and
render_startup_failure classification behavior.
🧹 Nitpick comments (1)
android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackSessionManager.kt (1)

117-195: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate ActiveVideoAttempt construction in the Playable and ReplanRequired branches.

Lines 117-135 and 177-195 build nearly identical ActiveVideoAttempt instances (same field set, differing only in sessionId/plan/serverFeatures/planAttemptKey/attemptedPlanKeys). Extracting a small factory helper would reduce the risk of the two branches drifting when a field is added later.

♻️ Suggested extraction
+    private fun newActiveAttempt(
+        fileId: Int,
+        profileId: String,
+        capabilities: ClientCodecCapabilities,
+        context: ClientPlaybackContext,
+        playbackAttemptId: String,
+        qualityPreference: String,
+        network: PlaybackNetworkSnapshot,
+        sessionId: String,
+        plan: PlaybackPlanV3,
+        serverFeatures: Set<String>,
+        planAttemptId: String,
+        planAttemptKey: String,
+    ) = ActiveVideoAttempt(
+        fileId = fileId,
+        profileId = profileId,
+        capabilities = capabilities,
+        context = context,
+        playbackAttemptId = playbackAttemptId,
+        qualityPreference = qualityPreference,
+        networkEvidence = network,
+        sessionId = sessionId,
+        plan = plan,
+        serverFeatures = serverFeatures,
+        planAttemptId = planAttemptId,
+        planAttemptKey = planAttemptKey,
+        localMutations = emptyList(),
+        attemptedPlanKeys = listOf(planAttemptKey),
+        attemptCount = 1,
+        startedAtElapsedRealtimeMs = SystemClock.elapsedRealtime(),
+        firstFrameReported = false,
+    )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackSessionManager.kt`
around lines 117 - 195, Extract the shared ActiveVideoAttempt construction into
a small factory helper near the surrounding playback-session logic,
parameterizing the differing sessionId, plan, serverFeatures, planAttemptId, and
planAttemptKey values. Update both the Playable and
PlaybackV3Validation.ReplanRequired branches to call the helper while preserving
their existing attemptedPlanKeys and all common field values.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/PlaybackStartupStallDetector.kt`:
- Around line 79-97: Reset or re-anchor decoderStartupAtMs whenever
playWhenReady is false in the playback startup stall detection flow. Ensure a
later resume starts a fresh decoder startup grace period rather than counting
paused time, while preserving the existing decoder_no_output and
render_startup_failure classification behavior.

---

Nitpick comments:
In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackSessionManager.kt`:
- Around line 117-195: Extract the shared ActiveVideoAttempt construction into a
small factory helper near the surrounding playback-session logic, parameterizing
the differing sessionId, plan, serverFeatures, planAttemptId, and planAttemptKey
values. Update both the Playable and PlaybackV3Validation.ReplanRequired
branches to call the helper while preserving their existing attemptedPlanKeys
and all common field values.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0856bb41-3ca0-48b5-b525-b56deee2fd29

📥 Commits

Reviewing files that changed from the base of the PR and between 4c972c7 and 678b315.

📒 Files selected for processing (29)
  • AGENTS.md
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/di/PlayerModule.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/AudioCapabilityManager.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/AuthenticatedDataSourceFactory.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/MediaAuthInterceptor.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/MediaAuthSession.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackNetworkMonitor.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackSessionManager.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackV3Session.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlayerOkHttpClient.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlayerStatsSnapshot.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/SubtitleManager.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/PlaybackStartupStallDetector.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/PostResumeVideoStallDetector.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/MediaAuthInterceptorTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/PlaybackBufferPolicyTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/PlayerStatsSnapshotReducerTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/audio/PassthroughSuppressionRegistryTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/video/PlaybackStartupStallDetectorTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/video/PostResumeVideoStallDetectorTest.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerOverlay.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerScreenStartPositionTest.kt
  • gradle/libs.versions.toml
  • libass-bridge/build.gradle.kts
  • scripts/check-no-mpv-runtime.sh
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/playback/PlaybackProtocolV3.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/repository/PlaybackRepository.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/model/playback/PlaybackProtocolV3Test.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/network/api/PlaybackApiTest.kt
🚧 Files skipped from review as they are similar to previous changes (20)
  • libass-bridge/build.gradle.kts
  • scripts/check-no-mpv-runtime.sh
  • gradle/libs.versions.toml
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackV3Session.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerScreenStartPositionTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/video/PostResumeVideoStallDetectorTest.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/MediaAuthSession.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/di/PlayerModule.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/repository/PlaybackRepository.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/network/api/PlaybackApiTest.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/MediaAuthInterceptor.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlayerStatsSnapshot.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerOverlay.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackNetworkMonitor.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/playback/PlaybackProtocolV3.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/AudioCapabilityManager.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/PlaybackBufferPolicyTest.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/model/playback/PlaybackProtocolV3Test.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/SubtitleManager.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/AuthenticatedDataSourceFactory.kt

Copy link
Copy Markdown
Contributor Author

Addressed the completed CodeRabbit review summary in 7b60314:

  • Paused playback now clears/re-anchors the startup decoder and transport clocks, so resume receives a fresh grace period instead of counting paused time. Added focused pause/resume regression coverage.
  • Consolidated the duplicated initial ActiveVideoAttempt construction into one factory while preserving every state field and attempt key.

Focused session/stall tests, the Media3-only guard, and both phone/TV debug builds pass.

@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


P2 Badge Use the effective TV file after V3 planning

When the V3 planner satisfies an auto/quality request with a different effective_media_file_id, the TV starter still publishes the originally selected version.fileId and its metadata. TvPlayerViewModel then prefers selectedFileId over mediaFileId for version switches, local track selection, missing-session reloads, and subtitle actions, so the TV UI and restarts remain pinned to the wrong version while the effective stream is playing; derive an effective file/version from resolved.mediaFileId or readyV3.plan.effectiveMediaFileId before building the result.



P2 Badge Populate TV sidecar subtitle choices

On TV V3 starts, resolved.subtitleUrls comes from PlaybackV3Session and only contains the selected subtitle artifact, often null when playback starts with subtitles off. TvPlayerScreen builds the MediaItem from state.subtitleUrls, so unselected catalog/external subtitles are never mounted and cannot appear in the HUD or be selected; merge the effective version's catalog subtitle tracks into this list before returning, as the mobile starter now does.

ℹ️ 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".

@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


P2 Badge Return the effective TV media file

Fresh evidence is that this TV starter still publishes the requested version.fileId even though resolved.mediaFileId or readyV3.plan.effectiveMediaFileId can point at a different file chosen by the V3 planner. When auto/quality selection resolves to another effective file, TvPlayerViewModel stores this value as selectedFileId and prefers it over mediaFileId for track persistence, version identity, and seek/recovery replans, so TV can save and recover against the requested file while playing the effective one. Use the resolved/effective file id and matching version metadata here.



P2 Badge Mount all TV subtitle choices

When a V3 TV start leaves subtitles off or returns only the selected converted artifact, resolved.subtitleUrls contains no catalog alternatives, so this mounts an empty/single subtitle list into TvPlayerScreen and Media3 never discovers the available sidecar choices. Mobile now merges the effective file's catalog tracks with the selected V3 artifact before returning subtitleUrls; TV needs the same catalog-based list or users cannot select unmounted subtitles from the tracks menu.

ℹ️ 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".

@Quick104

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Quick104

Copy link
Copy Markdown
Contributor Author

Addressed the two additional review-summary findings in 1bd1bcc:

  • TV startup now adopts the V3 effective file ID and its resolution/container/duration/chapters metadata for lifecycle, UI, persistence, and recovery.
  • Phone and TV now share a catalog-plus-plan subtitle-choice builder, preserving every catalog alternative while retaining the selected server artifact and keeping embedded bitmap tracks container-backed.

All shared, android-shared, phone, and TV unit-test suites pass.

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 14, 2026 •

Copy link
Copy Markdown

@Quick104 Thanks for the update. I'll go ahead and review the latest changes now, including the TV startup adoption of V3 effective file ID/metadata and the shared catalog-plus-plan subtitle-choice builder.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvVideoPlaybackStarter.kt`:
- Around line 128-133: Update the playback selection logic around
effectiveFileId and effectiveVersion so the file ID is derived from the version
actually selected from watchDetail.versions, including the fallback to version
when no catalog entry matches; use that single effectiveVersion consistently for
fileResolution, container and duration fallbacks, chapters, subtitle choices,
and sessionLifecycle.adoptActiveSession instead of retaining an unmatched
resolved ID.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 10d7261f-0877-4c26-9b29-4ef61b230757

📥 Commits

Reviewing files that changed from the base of the PR and between 75b9b2a and 1bd1bcc.

📒 Files selected for processing (17)
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/MediaAuthSession.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackSessionManager.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/PlaybackStartupStallDetector.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/MediaAuthInterceptorTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/PlaybackSessionManagerSeekReanchorTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/video/PlaybackStartupStallDetectorTest.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/MobileVideoPlaybackStarter.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerScreen.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModel.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModelSharedCoordinatorTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/SubtitleTrackSelectionTest.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvVideoPlaybackStarter.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/PlayerTrackEntriesTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModelSharedCoordinatorTest.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/playback/PlaybackSubtitleChoices.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/model/playback/PlaybackSubtitleChoicesTest.kt
🚧 Files skipped from review as they are similar to previous changes (12)
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/MediaAuthSession.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/PlayerTrackEntriesTest.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/MobileVideoPlaybackStarter.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/PlaybackStartupStallDetector.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/video/PlaybackStartupStallDetectorTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/PlaybackSessionManagerSeekReanchorTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModelSharedCoordinatorTest.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackSessionManager.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerScreen.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModel.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModelSharedCoordinatorTest.kt

@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: 1bd1bcc05d

ℹ️ 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".

@Quick104

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Quick104

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Quick104

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Quick104
Quick104 merged commit 4572bb2 into main Jul 14, 2026
4 checks passed
@Quick104
Quick104 deleted the codex/media3-playback-v3-wip branch July 14, 2026 02: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: 0edc91026e

ℹ️ 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".

sessionLifecycle.adoptActiveSession(
params = StartParams(
contentId = state.contentId,
fileId = fileId,

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 Adopt the effective file on mobile replans

When a mobile runtime replan resolves an auto/quality/output fallback to a different effective_media_file_id, this still re-homes the lifecycle under the originally selected fileId, and the state update below only swaps the stream/plan without updating selectedVersionIndex/mediaFileId/duration/chapters/subtitle metadata. In that case the phone can play file B while progress, stop ownership, track menus, and persistence remain attached to file A; use decision.session.mediaFileId or decision.plan.effectiveMediaFileId here as the TV replan path does.

Useful? React with 👍 / 👎.

requestHeaders = decision.plan.stream.headers,
container = decision.plan.stream.container ?: current.container,
startPosition = decision.plan.timeline.playerStartSeconds,
mediaMountGeneration = mountGeneration,

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 Merge planned subtitles after mobile replans

When a user selects a catalog-only subtitle row, the replan response is the first place the server returns the materialized sidecar in decision.session.subtitleUrls, but this remount only keeps the stale uiState.subtitleTracks. Since catalog-only rows now intentionally have blank URLs, the mount effect rebuilds Media3 with no sidecar for the newly selected subtitle, so converted/rendered subtitles can never appear until a full reload; update the subtitle list from the replan result before bumping the mount generation.

Useful? React with 👍 / 👎.

Comment on lines 105 to 106
audioTrackIndex = request.audioTrackIndex,
subtitleTrackIndex = request.subtitleTrackIndex,

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 Translate mobile startup track ordinals

When playback is launched from the phone detail selector with an explicit audio or subtitle row, request.audioTrackIndex/subtitleTrackIndex are UI/catalog ordinals, but startVideoSessionV3 treats them as stable media stream indexes and serializes file:<id>:audio|subtitle:<index>. On files whose stream indexes are not contiguous from zero, the initial V3 plan requests the wrong audio/subtitle track even though later replans translate ordinals; map through the selected version's audioTracks[ordinal].index and subtitleTracks[ordinal].index before this call.

Useful? React with 👍 / 👎.

Comment on lines 103 to 104
audioTrackIndex = request.audioTrackIndex,
subtitleTrackIndex = request.subtitleTrackIndex,

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 Translate TV startup track ordinals

TV detail/deep-link playback passes the selected row ordinal into VideoPlaybackStartRequest, but this V3 startup call forwards that value as the server/media-file track index. For files where audio/subtitle stream indexes are 1/2 or 3/5 rather than row 0/1, the very first plan starts with the wrong track before any replan path can apply its stable-index mapping; translate the request ordinals through the chosen FileVersion track metadata here.

Useful? React with 👍 / 👎.

audioTracks = version?.audioTracks ?: emptyList(),
selectedAudioIndex = playbackState.audioTrackIndex,
selectedAudioIndex = selectedAudioOrdinal,
selectedSubtitleIndex = resolvedSubtitleIndex,

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 Materialize catalog-only subtitles on initial mobile selection

When the server starts with subtitles off, buildPlaybackSubtitleChoices now keeps catalog alternatives as rows with blank URLs, and this initialization can auto/restore one of those rows by setting selectedSubtitleIndex. The screen then only attempts a local Media3 selection, so an external subtitle with no planned artifact is never requested from the V3 server and cannot appear on initial playback; if the resolved initial row has no URL, trigger a subtitle replan or defer selection until the artifact is materialized.

Useful? React with 👍 / 👎.

Comment on lines +63 to +69
PlayerSubtitleInfo(
index = selectedTracks.subtitle?.index ?: 0,
codec = artifact.format,
label = if (rendersEmbeddedBitmap) null else "Server subtitle",
source = if (rendersEmbeddedBitmap) "embedded" else "server_artifact",
url = if (rendersEmbeddedBitmap) "" else artifact.url,
),

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 Preserve subtitle artifact timing origins

For a V3 converted/rendered subtitle artifact with a non-zero timing_origin_seconds (for example a copy-mode HLS or re-anchored stream whose player timeline starts at 0 while cues are in source time), this conversion drops the timing origin and leaves only the raw URL/format. Media3 then parses the sidecar against the mounted player timeline with no offset, so captions can be shifted by the stream origin; carry the artifact timing through to the subtitle configuration/parser offset instead of discarding it here.

Useful? React with 👍 / 👎.

Comment on lines +188 to +190
subtitleUrls = buildPlaybackSubtitleChoices(
catalogTracks = effectiveVersion?.subtitleTracks.orEmpty(),
plannedTracks = resolved.subtitleUrls.orEmpty(),

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 Expose TV catalog subtitles outside Media3 tracks

When the TV starts with subtitles off, catalog subtitle alternatives are merged into subtitleUrls as metadata-only rows with blank URLs, but the TV HUD is populated from Media3-reported subtitleTracks, not from subtitleUrls. Because blank-url external rows are not mounted into Media3, users never see those subtitle choices and cannot trigger the V3 materialization path; add a TV picker path for catalog rows or request the artifact when such a row is chosen.

Useful? React with 👍 / 👎.

Comment on lines +72 to +76
// A sign-out that wins the race must not be undone by a late
// refresh response.
if (tokenManager.getRefreshToken().isNullOrBlank()) {
return@use false
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Verify the refresh token before saving media refreshes

The remaining fresh race is same-server re-auth: if the user signs out and logs back into the same configured server while an old media refresh response is in flight, serverId still matches and this guard only checks that some refresh token exists. The stale response can then reach saveTokens and overwrite the newly logged-in session; capture the refresh token used for the request and require it to still match (or save to a pinned scope) before persisting the response.

Useful? React with 👍 / 👎.

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