mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-06-18 04:58:12 +02:00
Use Math.Clamp instead of if statements
This commit is contained in:
parent
9c5d08f4d1
commit
800ff53e97
|
@ -126,17 +126,13 @@ namespace MediaBrowser.Model.Session
|
|||
|
||||
set
|
||||
{
|
||||
if (value > 10)
|
||||
if (value is null)
|
||||
{
|
||||
_playbackSpeed = 10;
|
||||
}
|
||||
else if (value < 0.1)
|
||||
{
|
||||
_playbackSpeed = 0.1;
|
||||
_playbackSpeed = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_playbackSpeed = value;
|
||||
_playbackSpeed = Math.Clamp((double)value, 0.1, 10.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,17 +88,13 @@ namespace MediaBrowser.Model.Session
|
|||
|
||||
set
|
||||
{
|
||||
if (value > 10)
|
||||
if (value is null)
|
||||
{
|
||||
_playbackSpeed = 10;
|
||||
}
|
||||
else if (value < 0.1)
|
||||
{
|
||||
_playbackSpeed = 0.1;
|
||||
_playbackSpeed = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_playbackSpeed = value;
|
||||
_playbackSpeed = Math.Clamp((double)value, 0.1, 10.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue