mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 03:31:05 +00:00
rtpbin: Fix division by zero when using ts-offset-smoothing-factor
avg_ts_offset may cause division by zero when calculating potential overflow protection. This fix will avoid the division. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2151>
This commit is contained in:
parent
ad434759a9
commit
e4a6521ac7
1 changed files with 4 additions and 2 deletions
|
@ -1362,10 +1362,12 @@ stream_set_ts_offset (GstRtpBin * bin, GstRtpBinStream * stream,
|
||||||
* ((bin->ts_offset_smoothing_factor - 1) * stream->avg_ts_offset
|
* ((bin->ts_offset_smoothing_factor - 1) * stream->avg_ts_offset
|
||||||
* + ts_offset) / bin->ts_offset_smoothing_factor
|
* + ts_offset) / bin->ts_offset_smoothing_factor
|
||||||
*/
|
*/
|
||||||
guint64 max_possible_smoothing_factor =
|
guint64 max_possible_smoothing_factor = G_MAXUINT64;
|
||||||
G_MAXINT64 / ABS (stream->avg_ts_offset);
|
|
||||||
gint64 cur_avg_product =
|
gint64 cur_avg_product =
|
||||||
(bin->ts_offset_smoothing_factor - 1) * stream->avg_ts_offset;
|
(bin->ts_offset_smoothing_factor - 1) * stream->avg_ts_offset;
|
||||||
|
if (stream->avg_ts_offset != 0)
|
||||||
|
max_possible_smoothing_factor =
|
||||||
|
G_MAXINT64 / ABS (stream->avg_ts_offset);
|
||||||
|
|
||||||
if ((max_possible_smoothing_factor < bin->ts_offset_smoothing_factor) ||
|
if ((max_possible_smoothing_factor < bin->ts_offset_smoothing_factor) ||
|
||||||
(cur_avg_product > 0 && G_MAXINT64 - cur_avg_product < ts_offset) ||
|
(cur_avg_product > 0 && G_MAXINT64 - cur_avg_product < ts_offset) ||
|
||||||
|
|
Loading…
Reference in a new issue