diff options
author | Mathieu Duponchelle <mathieu.duponchelle@opencreed.com> | 2017-08-08 13:11:58 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2017-08-17 13:35:22 +0300 |
commit | 3c3c1d3e205a397f744c46bd3a4f97acad71deb5 (patch) | |
tree | 1b2b4f9be33d7524298012de6506277b6d7d6383 | |
parent | 419a6d4532cfbbdc0aeb0a8c8419e8a411855512 (diff) | |
download | gstreamer-plugins-good-3c3c1d3e205a397f744c46bd3a4f97acad71deb5.tar.gz |
rtpstats: fix unsigned integer comparisons.
Callers of the API (rtpsource, rtpjitterbuffer) pass clock_rate
as a signed integer, and the comparison "<= 0" is used against
it, leading me to think the intention was to have the field
be typed as gint32, not guint32.
This led to situations where we could call scale_int with
a MAX_UINT32 (-1) guint32 as the denom, thus raising an
assertion.
https://bugzilla.gnome.org/show_bug.cgi?id=785991
-rw-r--r-- | gst/rtpmanager/rtpstats.c | 4 | ||||
-rw-r--r-- | gst/rtpmanager/rtpstats.h | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/gst/rtpmanager/rtpstats.c b/gst/rtpmanager/rtpstats.c index cc25dbf64..73bd189b7 100644 --- a/gst/rtpmanager/rtpstats.c +++ b/gst/rtpmanager/rtpstats.c @@ -22,7 +22,7 @@ #include "rtpstats.h" void -gst_rtp_packet_rate_ctx_reset (RTPPacketRateCtx * ctx, guint32 clock_rate) +gst_rtp_packet_rate_ctx_reset (RTPPacketRateCtx * ctx, gint32 clock_rate) { ctx->clock_rate = clock_rate; ctx->probed = FALSE; @@ -36,7 +36,7 @@ gst_rtp_packet_rate_ctx_update (RTPPacketRateCtx * ctx, guint16 seqnum, { guint64 new_ts, diff_ts; gint diff_seqnum; - guint32 new_packet_rate; + gint32 new_packet_rate; if (ctx->clock_rate <= 0) { return ctx->avg_packet_rate; diff --git a/gst/rtpmanager/rtpstats.h b/gst/rtpmanager/rtpstats.h index eb164de51..b0fbddb48 100644 --- a/gst/rtpmanager/rtpstats.h +++ b/gst/rtpmanager/rtpstats.h @@ -207,13 +207,13 @@ typedef struct { */ typedef struct { gboolean probed; - gint clock_rate; + gint32 clock_rate; guint16 last_seqnum; guint64 last_ts; guint32 avg_packet_rate; } RTPPacketRateCtx; -void gst_rtp_packet_rate_ctx_reset (RTPPacketRateCtx * ctx, guint32 clock_rate); +void gst_rtp_packet_rate_ctx_reset (RTPPacketRateCtx * ctx, gint32 clock_rate); guint32 gst_rtp_packet_rate_ctx_update (RTPPacketRateCtx *ctx, guint16 seqnum, guint32 ts); guint32 gst_rtp_packet_rate_ctx_get (RTPPacketRateCtx *ctx); guint32 gst_rtp_packet_rate_ctx_get_max_dropout (RTPPacketRateCtx *ctx, gint32 time_ms); |