Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ package com.playbridge.shared.player
* `tv/android/player/app/libs/mpv-android.aar` (`armeabi-v7a` and `arm64-v8a` `libavformat.so`).
* Caps FFmpeg itself to at most 3 reconnect attempts per disconnect/error with backoff capped at
* 5 seconds (`reconnect_delay_max=5,reconnect_max_retries=3`), and enables HTTP reconnect on
* streamed connections as well as network errors and `429`/`5xx` HTTP responses.
* network errors and `429`/`5xx` HTTP responses.
*
* Omits `reconnect_streamed`: with it FFmpeg treats the normal end of a response of unknown length
* (such as a gzip-compressed HLS playlist) as a dropped connection, re-requests past the end and
* fails to parse the playlist, so only the audio plays.
*/
object MpvLavfReconnectOptions {
const val MAX_RETRIES = 3
const val DELAY_MAX_SECONDS = 5
const val VALUE =
"reconnect=1,reconnect_streamed=1,reconnect_on_network_error=1," +
"reconnect=1,reconnect_on_network_error=1," +
"reconnect_on_http_error=\"429,5xx\",reconnect_delay_max=$DELAY_MAX_SECONDS," +
"reconnect_max_retries=$MAX_RETRIES"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package com.playbridge.shared.player

import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertTrue

class MpvLavfReconnectOptionsTest {
@Test fun includesRequiredBoundedReconnectOptions() {
val opts = MpvLavfReconnectOptions.VALUE
assertTrue(opts.contains("reconnect=1"))
assertTrue(opts.contains("reconnect_streamed=1"))
assertFalse(opts.contains("reconnect_streamed"))
assertTrue(opts.contains("reconnect_on_network_error=1"))
assertTrue(opts.contains("reconnect_on_http_error=\"429,5xx\""))
assertTrue(opts.contains("reconnect_delay_max=5"))
Expand Down
2 changes: 1 addition & 1 deletion tv/apple/docs/redesign-checks.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
- Custom font library limits (`SubtitleFontLimits`): max `10 MiB` per font, max `5` fonts, max `30 MiB` total library storage, and `192 KiB` upload chunks. Uploads verify SHA-256, parse sfnt `name` tables, and validate font data with CoreText (`CTFontManagerCreateFontDescriptorsFromData`) before registration.

- **mpv HTTP reconnect & freeze/EOF recovery (`PlaybackStallDetector`, `MPVPlayerView`)**
- Configures FFmpeg `lavf` reconnect options on both `stream-lavf-o` and `demuxer-lavf-o` (`reconnect=1,reconnect_streamed=1,reconnect_on_network_error=1,reconnect_on_http_error="429,5xx",reconnect_delay_max=5,reconnect_max_retries=3`), intentionally omitting `reconnect_at_eof` so finite VOD streams complete normally. Each FFmpeg outage retries at most 3 times (`0 s + 1 s + 3 s = 4 s` backoff sleep) before failing.
- Configures FFmpeg `lavf` reconnect options on both `stream-lavf-o` and `demuxer-lavf-o` (`reconnect=1,reconnect_on_network_error=1,reconnect_on_http_error="429,5xx",reconnect_delay_max=5,reconnect_max_retries=3`), intentionally omitting `reconnect_at_eof` so finite VOD streams complete normally, and `reconnect_streamed` so a gzip-compressed playlist of unknown length ends normally instead of being re-requested past its end. Each FFmpeg outage retries at most 3 times (`0 s + 1 s + 3 s = 4 s` backoff sleep) before failing.
- `PlaybackFreezeRecovery` monitors silent stalls (frozen `time-pos`) and premature EOFs from truncated HTTP streams, reloading at the last good position (`15 s` stall reload delay, `3 s` EOF-freeze reload delay, at most `2` recoveries without `2 s` of forward progress, and a hard cap of `6` total reloads per video reset only by a new item or pressing **Try again**) before presenting a failure screen within `PlaybackStallDetector`'s `30 s` startup / `45 s` mid-play budgets.

## Real-Hardware Manual Checks
Expand Down
Loading