[Android] FrameRate: fix NaN division crash

Duncan McNamara git at videolan.org
Tue Sep 13 05:16:38 UTC 2022


vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Mon Sep 12 18:19:30 2022 +0200| [d2fded406a17ec9f4d51e9f5b426a1202a991d55] | committer: Nicolas Pomepuy

FrameRate: fix NaN division crash

Fixes #2681

> https://code.videolan.org/videolan/vlc-android/commit/d2fded406a17ec9f4d51e9f5b426a1202a991d55
---

 application/vlc-android/src/org/videolan/vlc/util/FrameRateManager.kt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/application/vlc-android/src/org/videolan/vlc/util/FrameRateManager.kt b/application/vlc-android/src/org/videolan/vlc/util/FrameRateManager.kt
index ddc3709b7..1de7f8772 100644
--- a/application/vlc-android/src/org/videolan/vlc/util/FrameRateManager.kt
+++ b/application/vlc-android/src/org/videolan/vlc/util/FrameRateManager.kt
@@ -57,6 +57,8 @@ class FrameRateManager(val activity: FragmentActivity, val service: PlaybackServ
         /* automatic frame rate switching for displays/HDMI
         most media will be either 23.976, 24, 25, 29.97, 30, 48, 50, 59.94, and 60 fps */
         service.mediaplayer.currentVideoTrack?.let { videoTrack ->
+            if (videoTrack.frameRateDen == 0)
+                return at let
             val videoFrameRate = videoTrack.frameRateNum / videoTrack.frameRateDen.toFloat()
             val surface = surfaceView.holder.surface
 



More information about the Android mailing list