REFACTOR float to long for better precision

This commit is contained in:
2025-05-28 22:31:00 +02:00
parent c468625a74
commit 783485dd39

View File

@@ -26,7 +26,7 @@ public class CompressionService {
private static final float MAX_AUDIO_BITRATE = 128f; private static final float MAX_AUDIO_BITRATE = 128f;
private static final float BITRATE_MULTIPLIER = 0.9f; private static final float BITRATE_MULTIPLIER = 0.9f;
private final Pattern timePattern = Pattern.compile("out_time_ms=([\\d:.]+)"); private final Pattern timePattern = Pattern.compile("out_time_ms=(\\d+)");
private void buildFilters(ArrayList<String> command, Float fps, Integer width, Integer height) { private void buildFilters(ArrayList<String> command, Float fps, Integer width, Integer height) {
List<String> filters = new ArrayList<>(); List<String> filters = new ArrayList<>();
@@ -122,7 +122,7 @@ public class CompressionService {
Matcher matcher = timePattern.matcher(line); Matcher matcher = timePattern.matcher(line);
if (matcher.find()) { if (matcher.find()) {
Float progress = Float.parseFloat(matcher.group(1))/(length*1000000); Float progress = Long.parseLong(matcher.group(1))/(length*1000000);
job.setProgress(progress); job.setProgress(progress);
} }
} }