From a79616ea7a95ee50f5d9ebaf268d150fd11aab70 Mon Sep 17 00:00:00 2001 From: Camilo Celis Guzman Date: Tue, 25 Apr 2023 15:25:57 +0900 Subject: [PATCH] rtpvp8pay: avoid reseting PictureID if NO_PICTURE_ID mode is set There is no logical change here, as `& (1 << nbits) - 1` would produce also 0 when NO_PICTURE_ID mode is choosen. However, this avoid computing a random integer that is actually unused. Part-of: --- .../gst-plugins-good/gst/rtp/gstrtpvp8pay.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/rtp/gstrtpvp8pay.c b/subprojects/gst-plugins-good/gst/rtp/gstrtpvp8pay.c index bb967c7e42..99e9d7774c 100644 --- a/subprojects/gst-plugins-good/gst/rtp/gstrtpvp8pay.c +++ b/subprojects/gst-plugins-good/gst/rtp/gstrtpvp8pay.c @@ -112,13 +112,17 @@ gst_rtp_vp8_pay_picture_id_reset (GstRtpVP8Pay * obj) { gint nbits; - if (obj->picture_id_offset == -1) - obj->picture_id = g_random_int (); - else - obj->picture_id = obj->picture_id_offset; + if (obj->picture_id_mode == VP8_PAY_NO_PICTURE_ID) { + obj->picture_id = 0; + } else { + if (obj->picture_id_offset == -1) + obj->picture_id = g_random_int (); + else + obj->picture_id = obj->picture_id_offset; - nbits = picture_id_field_len (obj->picture_id_mode); - obj->picture_id &= (1 << nbits) - 1; + nbits = picture_id_field_len (obj->picture_id_mode); + obj->picture_id &= (1 << nbits) - 1; + } } static void