summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorJordan Petridis <jordan@centricular.com>2020-08-03 19:28:29 +0300
committerJordan Petridis <jordan@centricular.com>2020-08-04 18:56:45 +0300
commit8d3c0a1f8a8fa6411c3a4f50a06cd077118e7883 (patch)
tree250e80c26b18485f691c4b4ce2862d7ea2372916 /ext
parentedce08b526d9288ea75b0b3e0597030c8714d4cf (diff)
downloadgst-libav-8d3c0a1f8a8fa6411c3a4f50a06cd077118e7883.tar.gz
gstavcfg.c: fix max->min typo in limits and implict double conversion
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/86>
Diffstat (limited to 'ext')
-rw-r--r--ext/libav/gstavcfg.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/libav/gstavcfg.c b/ext/libav/gstavcfg.c
index 7f289d7..c736920 100644
--- a/ext/libav/gstavcfg.c
+++ b/ext/libav/gstavcfg.c
@@ -339,8 +339,13 @@ install_opts (GObjectClass * gobject_class, const AVClass ** obj, guint prop_id,
case AV_OPT_TYPE_UINT64:
/* ffmpeg expresses all ranges with doubles, this is appalling */
pspec = g_param_spec_uint64 (name, name, help,
- (gint64) (min == (gdouble) 0 ? 0 : min),
- (gint64) (max == (gdouble) UINT64_MAX ? UINT64_MAX : min),
+ (guint64) (min <= (gdouble) 0 ? 0 : (guint64) min),
+ (guint64) (max >=
+ /* Biggest value before UINT64_MAX that can be represented as double */
+ (gdouble) 18446744073709550000.0 ?
+ /* The Double conversion rounds UINT64_MAX to a bigger */
+ /* value, so the following smaller limit must be used. */
+ G_GUINT64_CONSTANT (18446744073709550000) : (guint64) max),
opt->default_val.i64, G_PARAM_READWRITE);
g_object_class_install_property (gobject_class, prop_id++, pspec);
break;