Skip to content

Commit

Permalink
rtphdrext-rfc6464: Put max level if the audio is beyond it
Browse files Browse the repository at this point in the history
Otherwise, it just fails to add the extension, which makes no
sense. And our level element produces levels higher than 127 in some
cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1058>
  • Loading branch information
ocrete authored and GStreamer Marge Bot committed Aug 30, 2021
1 parent 23d07f3 commit f70ccd6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions gst/rtpmanager/gstrtphdrext-rfc6464.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ gst_rtp_header_extension_rfc6464_write (GstRTPHeaderExtension * ext,
GstBuffer * output, guint8 * data, gsize size)
{
GstAudioLevelMeta *meta;
guint level;

g_return_val_if_fail (size >=
gst_rtp_header_extension_rfc6464_get_max_size (ext, NULL), -1);
Expand All @@ -231,10 +232,11 @@ gst_rtp_header_extension_rfc6464_write (GstRTPHeaderExtension * ext,
return 0;
}

if (meta->level > 127) {
GST_WARNING_OBJECT (ext, "level from meta is higher than 127: %d",
level = meta->level;
if (level > 127) {
GST_LOG_OBJECT (ext, "level from meta is higher than 127: %d, cropping",
meta->level);
return -1;
level = 127;
}

GST_LOG_OBJECT (ext, "writing ext (level: %d voice: %d)", meta->level,
Expand Down

0 comments on commit f70ccd6

Please sign in to comment.