Repository navigation
player: playback speed (0.5x-2x), done in the app - #805
Conversation
A Playback speed row in the … menu, onto Plex Web's speeds, offered only where the playback can play them (not segmented HLS, not a preview, the audio decodable, never more than 60 fps fed). A speed is fixed per Load; a change reloads at the viewer's position. LG's SetPlayRate cannot drive the buffer-feed pipeline (tried on 3.9.3: reset to 1x by the source's next SEGMENT when set at load, a permanent freeze when set mid-play, and libpf mutes audio off 1x), so the speed is done the way a browser does it: - every timestamp crossing to the pipeline is divided by the speed (player::to_sink_ns) and every presented one multiplied back, so the pipeline plays at its own 1x and the app stays in film time; the Load declares the fed frame rate; - the Load declares PCM (contents.pcmInfo; sampleRate is kHz, libpf matches 48 not 48000), ff::SpeedDecoder decodes the audio with the bundled FFmpeg (audio decoders added to ci/build-ffmpeg.sh), and speed_audio downmixes to stereo, resamples to 48 kHz and WSOLA time-stretches it with pitch preserved; - a safety net reloads at 1x and turns speed off if the pipeline's audio report is not the declared 48 kHz stereo, or never arrives. Verified on an OLED55B7V-Z (webOS 3.9.3) only. Signed-off-by: Dimitrije Juras <[email protected]>
…n the Audio row Signed-off-by: Dimitrije Juras <[email protected]>
|
Sorry for the delay. I want to keep this feature for the next release, so I'll get back to this PR after the 0.9.0 release |
Conflicts resolved: both sides' catalog entries kept (list-caps, widgets locales; it follows main's flat format, de/hu/pt gain the speed rows); the More menu root keeps the Quality readout and the Playback speed row; the speed audio push goes through main's audio_push_gate.
…ured decoder row can be fed The noaudio trigger was a stat(2) per call at three sites (speed_offer every frame while the More menu is open, the pump's speed check every tick, the Load): one latched flag now. speed_offer filtered by a flat 60.5 fps, but the Load clamps the declared rate to the device's measured decoder row, so on a 4K@30 H.264 set a 24p stream at 1.5x was offered and fed at 36 fps. The ceiling now comes from the same row (decoder_row, shared with sink_envelope).
…menu and the diagnostics row
…ize samples with SampleFormat::bytes
Co-Authored-By: Claude Opus 5.5 <[email protected]>
GLinnik21
left a comment
There was a problem hiding this comment.
Tested on our 4.5 set: 0.5x-2x played at the right rate on E-AC-3, DTS, AAC and 4K H.264, seek/pause/EOS fine. I merged main and pushed small fixes to your branch: noaudio latched, the speed offer follows the measured decoder row, the nits, plus speed strings for the new de/hu/pt locales. Main ask is the reload going through the route controller.
| if !is_started() { | ||
| return true; // nothing on screen: the next Load applies it | ||
| } | ||
| SHARED.rate_reload.store(true, Relaxed); |
There was a problem hiding this comment.
Could this use request_user_route_intent like the audio switch? The stuck-seek retry at pump.rs:1632 can eat this seek.
| let offer = speed_offer(ps); | ||
| let rate = session_rate(want, &offer); | ||
| if rate != want { | ||
| SHARED.play_rate_permille.store(RATE_NORMAL, Relaxed); |
There was a problem hiding this comment.
Rather not overwrite the viewer's pick here. Show the applied rate instead?
| /// so every timestamp the app hands it — a fed AU, a seek or decode position — is divided by `r`; | ||
| /// the frames then arrive `r` times closer together and the picture runs `r` times faster. | ||
| /// Identity at 1x, which is every playback that has not picked a speed. | ||
| pub fn to_sink_ns(ns: i64) -> i64 { |
There was a problem hiding this comment.
Could the sink seam own the rate instead of 5 call sites + a global?
| } | ||
|
|
||
| /// Content time of output frame `n`: each output frame stands for `speed` input frames. | ||
| fn content_pts(&self, n: u64) -> i64 { |
There was a problem hiding this comment.
pts_ns is ignored after the first push, so a gap drifts until the next seek. Re-anchor?
| static FORCE_SPEED_DECODER: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false); | ||
| #[cfg(any(test, feature = "test-support"))] | ||
| pub fn force_speed_decoder_for_test(on: bool) { | ||
| FORCE_SPEED_DECODER.store(on, Ordering::Relaxed); |
There was a problem hiding this comment.
Set in ~30 tests, reset in one, so order-dependent. Pass the offer to the menu as a value?
Brings in #805 (player playback speed); no file it touches is one this lane changed. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
libpf matches pcmInfo.sampleRate against a kilohertz table (plxnative#805). The FLAC node stated hertz, so every FLAC played at the 44.1 kHz fallback: on an OLED55B8 (webOS 4.4.3) a 1 kHz tone came back at 918.8 Hz from a 48 kHz file, 1378 Hz from 32 kHz and about 2006 Hz from 22.05 kHz. Declared in kHz, all four rates play at 1000 Hz and the pipeline reports the declared rate. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01BNxR112kqmb5uZjUzXgND1 Signed-off-by: Paulo Richards <[email protected]>
Adds a Playback speed row to the player's
…menu, with Plex Web's speeds: 0.5×, 0.75×, Normal, 1.25×, 1.5×, 1.75× and 2×.Why it's done in the app, not with LG's
SetPlayRateStarfishMediaAPIs::SetPlayRateexists on firmware 1.2–11.2, but it can't drive the buffer-feed pipeline. I tried it on webOS 3.9.3:CustomPipeline::sendSegmentEventhard-codes rate 1.0.gst_element_seek(rate, FLUSH|KEY_UNIT, …)against our appsrc.setAudioForTrickPlay).So the speed is done the way a browser does it:
player::to_sink_ns), and every presented one is multiplied back. The pipeline plays at its own 1×, the app stays in film time, and the Load declares the frame rate it is actually fed.contents.pcmInfo). Note thatsampleRateis in kHz: libpf matches 48, not 48000, and 48000 falls back to 44.1 with drift.ff::SpeedDecoderdecodes the audio with the bundled FFmpeg (audio decoders added toci/build-ffmpeg.sh).speed_audiothen downmixes to stereo, resamples to 48 kHz, and time-stretches with WSOLA so the pitch is kept. Audio is stereo while sped up.Where the row is offered
The row appears only where the playback can play the speed: not for segmented HLS, not for previews, only when the audio is decodable, and only speeds that keep the fed rate at or under 60 fps.
A safety net reloads at 1× and turns speed off for the session in two cases: the pipeline's audio report isn't the declared 48 kHz stereo, or no report arrives within 8 s of
loadCompleted.Stats for nerds gets a speed suffix on the Audio row, for example
speed 1.5x pcm 48 khz stereo ok.Tested
audio/x-raw 48 kHz x2 -> ok, and the Audio row readspeed 1.5x pcm 48 khz stereo ok. At 0.5×, 24p film shows 12 fps, which is inherent.make checkpasses (16,390 tests, 0 failed), and so doescargo +nightly check --lib --no-default-features.Translations
The
be,fr,esanditstrings (2 each) are my drafts, not reviewed by a native speaker. Per CONTRIBUTING, hold them until someone reviews them, or drop them and let those locales fall back to English.