rtphdrext-clientaudiolevel: Fix level value being written by the extension

When level value is greater than 127, it was being clamped but this clamped
value was not the one being actually used. For level values greater than 127
this resulted in an incorrect value being used. As an example, a level value
of 187, after and'ed with 0x7F, it would result in 0x3B being reported as the
level value.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5893>
This commit is contained in:
Sanchayan Maity 2023-11-16 11:42:27 +05:30
parent e3be7e3162
commit 00bbac6541

View file

@ -176,11 +176,11 @@ gst_rtp_header_extension_client_audio_level_write (GstRTPHeaderExtension * ext,
level = 127;
}
GST_LOG_OBJECT (ext, "writing ext (level: %d voice: %d)", meta->level,
GST_LOG_OBJECT (ext, "writing ext (level: %d voice: %d)", level,
meta->voice_activity);
/* Both one & two byte use the same format, the second byte being padding */
data[0] = (meta->level & 0x7F) | (meta->voice_activity << 7);
data[0] = (level & 0x7F) | (meta->voice_activity << 7);
if (write_flags & GST_RTP_HEADER_EXTENSION_ONE_BYTE) {
return 1;
}