Fix crash in quality auto-toggle.

This commit is contained in:
John Preston 2024-10-31 20:32:54 +04:00
parent 0067245739
commit 7684466acf
2 changed files with 8 additions and 5 deletions

View File

@ -73,10 +73,7 @@ PlaybackControls::PlaybackControls(
_speedToggle->setSpeed(_speedControllable
? _delegate->playbackControlsCurrentSpeed(false)
: 1.);
const auto quality = _delegate->playbackControlsCurrentQuality();
_speedToggle->setQuality((_qualitiesList.empty() || !quality.manual)
? 0
: quality.height);
updateSpeedToggleQuality();
if (const auto controller = _speedController.get()) {
controller->menuToggledValue(
@ -221,10 +218,15 @@ void PlaybackControls::saveSpeed(float64 speed) {
}
void PlaybackControls::saveQuality(int quality) {
_speedToggle->setQuality(quality);
_speedToggle->setQuality(_qualitiesList.empty() ? 0 : quality);
_delegate->playbackControlsQualityChanged(quality);
}
void PlaybackControls::updateSpeedToggleQuality() {
const auto quality = _delegate->playbackControlsCurrentQuality();
_speedToggle->setQuality(_qualitiesList.empty() ? 0 : quality.height);
}
void PlaybackControls::updatePlaybackSpeed(float64 speed) {
DEBUG_LOG(("Media playback speed: update to %1.").arg(speed));
_delegate->playbackControlsSpeedChanged(speed);

View File

@ -97,6 +97,7 @@ private:
void saveSpeed(float64 speed);
void saveQuality(int quality);
void updateSpeedToggleQuality();
const not_null<Delegate*> _delegate;