summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-11-29 00:34:53 +0100
committerwm4 <wm4@nowhere>2014-11-29 00:37:34 +0100
commit87f5ba6ab3eb468d54f16a628a06bd5a01bb222c (patch)
tree3660decb48f95d66d1f2913fb76f1e01a64e6a50 /player
parenta937ba203dfad2b3d0a5dd349015cc608c8d6dd4 (diff)
downloadmpv-87f5ba6ab3eb468d54f16a628a06bd5a01bb222c.tar.bz2
mpv-87f5ba6ab3eb468d54f16a628a06bd5a01bb222c.tar.xz
command: avoid returning invalid FPS values
It's possible that fps is sometimes 0 in case it's unset.
Diffstat (limited to 'player')
-rw-r--r--player/command.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/player/command.c b/player/command.c
index 2da13731e6..6b9cfa66e6 100644
--- a/player/command.c
+++ b/player/command.c
@@ -23,6 +23,7 @@
#include <stdbool.h>
#include <assert.h>
#include <time.h>
+#include <math.h>
#include <pthread.h>
#include <sys/types.h>
@@ -2535,9 +2536,10 @@ static int mp_property_fps(void *ctx, struct m_property *prop,
int action, void *arg)
{
MPContext *mpctx = ctx;
- if (!mpctx->d_video)
- return M_PROPERTY_UNAVAILABLE;
- return m_property_float_ro(action, arg, mpctx->d_video->fps);
+ float fps = mpctx->d_video ? mpctx->d_video->fps : 0;
+ if (fps < 0.1 || !isfinite(fps))
+ return M_PROPERTY_UNAVAILABLE;;
+ return m_property_float_ro(action, arg, fps);
}
static int mp_property_vf_fps(void *ctx, struct m_property *prop,