mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-11 17:30:00 +02:00
fix(adaptive-bitrate): correct operator precedence in bitrate calculations
Fixed NaN errors in FFmpeg bitrate argument generation by ensuring integer conversion happens before integer division. The double multiplication (1.5, 2.0) was happening before the ~/ operator, causing NaN values. Now properly converts to int first, then divides. - maxRateArg: ((bitrateBps * 1.5).toInt() ~/ 1000) - bufferSizeArg: ((bitrateBps * 2).toInt() ~/ 1000) Fixes: Unsupported operation: Result of truncating division is NaN Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1bc9223665
commit
29888c9b2a
1 file changed
+2
-2
@@ -28,10 +28,10 @@ class QualityLevel {
|
|||||||
String get videoBitrateArg => '${(bitrateBps * 0.75).toInt() ~/ 1000}k';
|
String get videoBitrateArg => '${(bitrateBps * 0.75).toInt() ~/ 1000}k';
|
||||||
|
|
||||||
/// Get FFmpeg maxrate argument (150% of bitrate)
|
/// Get FFmpeg maxrate argument (150% of bitrate)
|
||||||
String get maxRateArg => '${(bitrateBps * 1.5 ~/ 1000).toInt()}k';
|
String get maxRateArg => '${((bitrateBps * 1.5).toInt() ~/ 1000)}k';
|
||||||
|
|
||||||
/// Get FFmpeg buffer size argument
|
/// Get FFmpeg buffer size argument
|
||||||
String get bufferSizeArg => '${(bitrateBps * 2 ~/ 1000).toInt()}k';
|
String get bufferSizeArg => '${((bitrateBps * 2).toInt() ~/ 1000)}k';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => '$label ($resolution - ${bitrateBps ~/ 1000000}Mbps)';
|
String toString() => '$label ($resolution - ${bitrateBps ~/ 1000000}Mbps)';
|
||||||
|
|||||||
Reference in new issue
Block a user