DynamicRangeCompressor settings are not restored automatically on video playback (only applied when opening dialog)
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
- #1 @SamoTech による — マージされずにクローズ
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 63/100
調査の方向性
Start in app/src/main/java/com/lagradost/cloudstream3/ui/player/FullScreenPlayer.kt and trace when the player and compressor become available relative to restoreCompressorSettings(). Then read DynamicRangeCompressor.kt and the player load or initialization path to identify a restoration point after the compressor is created. Done means saved settings, including enabled state, are active when a new video starts without opening the dialog.
索引モデルが issue の本文から書いたものです。
説明
Steps to reproduce
- Enable the
Dynamic Range Compressorsetting in CloudStream Player Settings. - Play any video in the player and turn ON the compressor in the compressor dialog (or apply a preset).
- Close the player or play another episode/video.
- Listen to the audio during playback: the compressor is NOT active (dialogues are quiet, volume spikes are untamed).
- Tap the screen to reveal player controls and tap the Compressor button (
playerCompressorBtt) to open the compressor dialog. - The exact instant the dialog opens, the compressor immediately kicks in and the audio becomes compressed / boosted.
Expected behavior
When DynamicRangeCompressor has been enabled by the user, newly played videos should automatically restore and activate the compressor settings upon playback initialization without requiring the user to tap the screen and open the compressor dialog manually.
Actual behavior
Every newly started video plays with DynamicRangeCompressor.enabled = false. It is only switched to enabled = true when the user manually taps the compressor button to open showCompressorDialog().
Cloudstream version and commit hash
Pre-release / master branch (Commit 4e2516d / PR #3117)
Android version
Android 12+ (All versions, TV and Phone)
Logcat
N/A (Functional lifecycle timing issue in player initialization)
Other details
Root Cause Analysis
In app/src/main/java/com/lagradost/cloudstream3/ui/player/FullScreenPlayer.kt:
restoreCompressorSettings() is only called in two locations:
- In
onBindingCreated():
playerBinding?.apply {
playerSpeedBtt.isVisible = playBackSpeedEnabled
playerCompressorBtt.isVisible = playBackCompressorEnabled
if (playBackCompressorEnabled) {
restoreCompressorSettings()
}
...
- In
showCompressorDialog():
private fun showCompressorDialog() {
val act = activity ?: return
val compressor = (player as? CS3IPlayer)?.compressor ?: return
// Always restore — CS3IPlayer is recreated between videos
restoreCompressorSettings()
...
Inside restoreCompressorSettings():
protected fun restoreCompressorSettings() {
val c = (player as? CS3IPlayer)?.compressor ?: return
c.enabled = getKey(COMPRESSOR_ENABLED_KEY) ?: false
c.threshold = getKey(COMPRESSOR_THRESHOLD_KEY) ?: -24f
c.ratio = getKey(COMPRESSOR_RATIO_KEY) ?: 8f
c.attackMs = getKey(COMPRESSOR_ATTACK_KEY) ?: 5f
c.releaseMs = getKey(COMPRESSOR_RELEASE_KEY) ?: 400f
c.makeupGain = getKey(COMPRESSOR_MAKEUP_KEY) ?: 12f
}
The Bug:
When onBindingCreated() runs, the media stream has not yet started loading and ExoPlayer has not yet built its renderers. Therefore, (player as? CS3IPlayer)?.compressor is still null.
As a result, val c = (player as? CS3IPlayer)?.compressor ?: return immediately returns without doing anything.
Later, when CS3IPlayer.load() executes and builds ExoPlayer, a new instance of DynamicRangeCompressor is created. In DynamicRangeCompressor.kt:
@Volatile var enabled: Boolean = false
The compressor is initialized with enabled = false. Because restoreCompressorSettings() is never called again after load(), the compressor remains OFF throughout playback.
When the user manually taps the compressor button while the video is playing, showCompressorDialog() is invoked. At that point, compressor is no longer null, so restoreCompressorSettings() finally runs and turns c.enabled = true.
Suggested Fix
Call restoreCompressorSettings() once the player / renderers are actually initialized (e.g. inside CS3IPlayer.load() after creating DynamicRangeCompressor, or on Player.Listener.onPlaybackStateChanged / onRenderedFirstFrame in FullScreenPlayer).
Alternatively, pass the initial enabled state and saved values from DataStore directly into DynamicRangeCompressor's constructor or factory when CS3IPlayer creates it in setRenderersFactory.
Acknowledgements
- I am sure my issue is related to the app and NOT some extension.
- I have searched the existing issues and this is a new ticket, NOT a duplicate or related to another open issue.
- I have written a short but informative title.
- I have updated the app to pre-release version Latest.
- I will fill out all of the requested information in this form.
- 主要言語
- Kotlin
- スター
- 10.9k
- フォーク
- 1.1k
- 平均マージ
- 2日 17時間
- マージ済み PR(30日)
- 24
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
recloudstream/cloudstream のほかの issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
recloudstream/cloudstream#3100 ·
メンテナーはふだん 2 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
recloudstream/cloudstream#2639 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 2 日以内に返信
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
recloudstream/cloudstream#3249 ·
メンテナーはふだん 2 日以内に返信
-
enhancement
難易度 3/5 1〜2日 初心者へのやさしさ 22/100
recloudstream/cloudstream#3248 ·
メンテナーはふだん 2 日以内に返信
-
New update Whenオープンenhancement
難易度 5/5 1週間以上 初心者へのやさしさ 5/100
recloudstream/cloudstream#3247 ·
メンテナーはふだん 2 日以内に返信
recloudstream/cloudstream の issue をすべて見る
似ている issue
-
afk-ok area:data-quality importer size:S
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
enorm-labs/event-junkie#3027 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
libre-tube/LibreTube#8854 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
rustyrazorblade/easy-db-lab#1003 ·
メンテナーはふだん 1 日以内に返信