diff options
author | wm4 <wm4@nowhere> | 2014-11-29 00:34:53 +0100 |
---|---|---|
committer | Diogo Franco (Kovensky) <diogomfranco@gmail.com> | 2015-01-25 17:00:11 +0900 |
commit | 0692da30077b162dd86049ff3f802137e9952937 (patch) | |
tree | 4522b1a0e17bd40c293bbbe692dc4a8112a5a8ff | |
parent | 0fcb96139d2b767d22547c878aa21c80197dd7f5 (diff) | |
download | mpv-0692da30077b162dd86049ff3f802137e9952937.tar.bz2 mpv-0692da30077b162dd86049ff3f802137e9952937.tar.xz |
command: avoid returning invalid FPS values
It's possible that fps is sometimes 0 in case it's unset.
-rw-r--r-- | player/command.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/player/command.c b/player/command.c index 893bbd9a94..30189c72a5 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> @@ -2534,9 +2535,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, |