Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/GStreamer/gst-plugins-good.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavard Graff <havard@pexip.com>2020-05-03 14:17:46 +0300
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2020-06-26 18:29:25 +0300
commit57eebe8b05e766af42a2023a3837e72e487c68ff (patch)
tree31c57786e8fdbdadce1afc5d2a37dddbcf0622c0 /gst/rtpmanager
parente45cc475bd9722bd4a8e2463dd04c16b7f513dd8 (diff)
rtpstats: guard against division by zero
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/646>
Diffstat (limited to 'gst/rtpmanager')
-rw-r--r--gst/rtpmanager/rtpstats.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gst/rtpmanager/rtpstats.c b/gst/rtpmanager/rtpstats.c
index 88e5f07d0..45fff3705 100644
--- a/gst/rtpmanager/rtpstats.c
+++ b/gst/rtpmanager/rtpstats.c
@@ -622,10 +622,12 @@ rtp_twcc_stats_calculate_windowed_stats (RTPTWCCStats * stats)
stats->avg_delta_of_delta = avg_delta_of_delta;
}
- stats->bitrate_sent =
- gst_util_uint64_scale (bits_sent, GST_SECOND, local_duration);
- stats->bitrate_recv =
- gst_util_uint64_scale (bits_recv, GST_SECOND, remote_duration);
+ if (local_duration > 0)
+ stats->bitrate_sent =
+ gst_util_uint64_scale (bits_sent, GST_SECOND, local_duration);
+ if (remote_duration > 0)
+ stats->bitrate_recv =
+ gst_util_uint64_scale (bits_recv, GST_SECOND, remote_duration);
GST_DEBUG ("Got stats: bits_sent: %u, bits_recv: %u, packets_sent = %u, "
"packets_recv: %u, packetlost_pct = %f, sent_bitrate = %u, "