[PATCH] Fix bitrate rounding error
Posted: Sat Jan 19, 2019 11:39 pm
It may occur that the bitrate (that e.g. mpv returns) varies, though the actual track has CBR. This can affect e.g. MPEG-TS audio tracks due to timestamp precision loss after clock conversion within mpv. So over time mpv returns e.g. the bitrates 192000 and 191999 alternatingly. As SMPlayer shows the bitrate in kbps, this would be no issue, as 192 kbps results then. However the retrieved bitrate (bits/second) is divided by 1000 and then implicitely converted to int. Thus the fractional part is just truncated instead of rounded. So the two described values result in the shown bitrate changing between 192 and 191 kbps regularly - which is of course annoying.
The attached patch fixes this by applying proper rounding to the bitrates. Note that I only checked the GUI fix, but not the info file case.
Note that I also opened a to fix a similar rounding issue there, too. While this mpv fix by accident also fixes the shown bitrate in SMPlayer, this patch here should be applied nevertheless, to also address users with older mplayer/mpv versions.
The attached patch fixes this by applying proper rounding to the bitrates. Note that I only checked the GUI fix, but not the info file case.
Note that I also opened a to fix a similar rounding issue there, too. While this mpv fix by accident also fixes the shown bitrate in SMPlayer, this patch here should be applied nevertheless, to also address users with older mplayer/mpv versions.