rtphdrext-clientaudiolevel: Rename RFC 6464 element

Multiplying elements named after RFC numbers is confusing,
so let's give them meaningful names.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1125>
This commit is contained in:
Olivier Crête 2021-09-15 14:19:06 -04:00 committed by GStreamer Marge Bot
parent 58caa8af62
commit 0dbe0e21fe
8 changed files with 81 additions and 71 deletions

View file

@ -63063,8 +63063,8 @@
"rtph265pay", "rtph265pay",
"rtph265pay:aggregate-mode", "rtph265pay:aggregate-mode",
"rtph265pay:config-interval", "rtph265pay:config-interval",
"rtphdrextrfc6464", "rtphdrextclientaudiolevel",
"rtphdrextrfc6464:vad", "rtphdrextclientaudiolevel:vad",
"rtphdrexttwcc", "rtphdrexttwcc",
"rtphdrexttwcc:n-streams", "rtphdrexttwcc:n-streams",
"rtpilbcdepay", "rtpilbcdepay",

View file

@ -17162,12 +17162,12 @@
}, },
"rank": "none" "rank": "none"
}, },
"rtphdrextrfc6464": { "rtphdrextclientaudiolevel": {
"RTP-Header-Extension-URI": "urn:ietf:params:rtp-hdrext:ssrc-audio-level", "RTP-Header-Extension-URI": "urn:ietf:params:rtp-hdrext:ssrc-audio-level",
"author": "Guillaume Desmottes <guillaume.desmottes@collabora.com>", "author": "Guillaume Desmottes <guillaume.desmottes@collabora.com>",
"description": "Client-to-Mixer Audio Level Indication (RFC6464) RTP Header Extension", "description": "Client-to-Mixer Audio Level Indication (RFC6464) RTP Header Extension",
"hierarchy": [ "hierarchy": [
"GstRTPHeaderExtensionRfc6464", "GstRTPHeaderExtensionClientAudioLevel",
"GstRTPHeaderExtension", "GstRTPHeaderExtension",
"GstElement", "GstElement",
"GstObject", "GstObject",

View file

@ -14,8 +14,8 @@
*/ */
/** /**
* SECTION:element-rtphdrextrfc6464 * SECTION:element-rtphdrextclientaudiolevel
* @title: rtphdrextrfc6464 * @title: rtphdrextclientaudiolevel
* @short_description: Client-to-Mixer Audio Level Indication (RFC6464) RTP Header Extension * @short_description: Client-to-Mixer Audio Level Indication (RFC6464) RTP Header Extension
* *
* Client-to-Mixer Audio Level Indication (RFC6464) RTP Header Extension. * Client-to-Mixer Audio Level Indication (RFC6464) RTP Header Extension.
@ -38,14 +38,14 @@
#include "config.h" #include "config.h"
#endif #endif
#include "gstrtphdrext-rfc6464.h" #include "gstrtphdrext-clientaudiolevel.h"
#include <gst/audio/audio.h> #include <gst/audio/audio.h>
#define RFC6464_HDR_EXT_URI GST_RTP_HDREXT_BASE"ssrc-audio-level" #define CLIENT_AUDIO_LEVEL_HDR_EXT_URI GST_RTP_HDREXT_BASE"ssrc-audio-level"
GST_DEBUG_CATEGORY_STATIC (rtphdrrfc6464_twcc_debug); GST_DEBUG_CATEGORY_STATIC (rtphdrclient_audio_level_debug);
#define GST_CAT_DEFAULT (rtphdrrfc6464_twcc_debug) #define GST_CAT_DEFAULT (rtphdrclient_audio_level_debug)
#define DEFAULT_VAD TRUE #define DEFAULT_VAD TRUE
@ -55,26 +55,27 @@ enum
PROP_VAD, PROP_VAD,
}; };
struct _GstRTPHeaderExtensionRfc6464 struct _GstRTPHeaderExtensionClientAudioLevel
{ {
GstRTPHeaderExtension parent; GstRTPHeaderExtension parent;
gboolean vad; gboolean vad;
}; };
G_DEFINE_TYPE_WITH_CODE (GstRTPHeaderExtensionRfc6464, G_DEFINE_TYPE_WITH_CODE (GstRTPHeaderExtensionClientAudioLevel,
gst_rtp_header_extension_rfc6464, GST_TYPE_RTP_HEADER_EXTENSION, gst_rtp_header_extension_client_audio_level, GST_TYPE_RTP_HEADER_EXTENSION,
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "rtphdrextrfc6464", 0, GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "rtphdrextclientaudiolevel", 0,
"RTP RFC 6464 Header Extensions");); "RTP RFC 6464 Header Extensions"););
GST_ELEMENT_REGISTER_DEFINE (rtphdrextrfc6464, "rtphdrextrfc6464", GST_ELEMENT_REGISTER_DEFINE (rtphdrextclientaudiolevel,
GST_RANK_MARGINAL, GST_TYPE_RTP_HEADER_EXTENSION_RFC6464); "rtphdrextclientaudiolevel", GST_RANK_MARGINAL,
GST_TYPE_RTP_HEADER_EXTENSION_CLIENT_AUDIO_LEVEL);
static void static void
gst_rtp_header_extension_rfc6464_get_property (GObject * object, gst_rtp_header_extension_client_audio_level_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec) guint prop_id, GValue * value, GParamSpec * pspec)
{ {
GstRTPHeaderExtensionRfc6464 *self = GstRTPHeaderExtensionClientAudioLevel *self =
GST_RTP_HEADER_EXTENSION_RFC6464 (object); GST_RTP_HEADER_EXTENSION_CLIENT_AUDIO_LEVEL (object);
switch (prop_id) { switch (prop_id) {
case PROP_VAD: case PROP_VAD:
@ -87,15 +88,15 @@ gst_rtp_header_extension_rfc6464_get_property (GObject * object,
} }
static GstRTPHeaderExtensionFlags static GstRTPHeaderExtensionFlags
gst_rtp_header_extension_rfc6464_get_supported_flags (GstRTPHeaderExtension * gst_rtp_header_extension_client_audio_level_get_supported_flags
ext) (GstRTPHeaderExtension * ext)
{ {
return GST_RTP_HEADER_EXTENSION_ONE_BYTE | GST_RTP_HEADER_EXTENSION_TWO_BYTE; return GST_RTP_HEADER_EXTENSION_ONE_BYTE | GST_RTP_HEADER_EXTENSION_TWO_BYTE;
} }
static gsize static gsize
gst_rtp_header_extension_rfc6464_get_max_size (GstRTPHeaderExtension * ext, gst_rtp_header_extension_client_audio_level_get_max_size (GstRTPHeaderExtension
const GstBuffer * input_meta) * ext, const GstBuffer * input_meta)
{ {
return 2; return 2;
} }
@ -103,7 +104,8 @@ gst_rtp_header_extension_rfc6464_get_max_size (GstRTPHeaderExtension * ext,
static void static void
set_vad (GstRTPHeaderExtension * ext, gboolean vad) set_vad (GstRTPHeaderExtension * ext, gboolean vad)
{ {
GstRTPHeaderExtensionRfc6464 *self = GST_RTP_HEADER_EXTENSION_RFC6464 (ext); GstRTPHeaderExtensionClientAudioLevel *self =
GST_RTP_HEADER_EXTENSION_CLIENT_AUDIO_LEVEL (ext);
if (self->vad == vad) if (self->vad == vad)
return; return;
@ -114,8 +116,9 @@ set_vad (GstRTPHeaderExtension * ext, gboolean vad)
} }
static gboolean static gboolean
gst_rtp_header_extension_rfc6464_set_attributes (GstRTPHeaderExtension * ext, gst_rtp_header_extension_client_audio_level_set_attributes
GstRTPHeaderExtensionDirection direction, const gchar * attributes) (GstRTPHeaderExtension * ext, GstRTPHeaderExtensionDirection direction,
const gchar * attributes)
{ {
if (g_str_equal (attributes, "vad=on") || g_str_equal (attributes, "")) { if (g_str_equal (attributes, "vad=on") || g_str_equal (attributes, "")) {
set_vad (ext, TRUE); set_vad (ext, TRUE);
@ -130,10 +133,11 @@ gst_rtp_header_extension_rfc6464_set_attributes (GstRTPHeaderExtension * ext,
} }
static gboolean static gboolean
gst_rtp_header_extension_rfc6464_set_caps_from_attributes (GstRTPHeaderExtension gst_rtp_header_extension_client_audio_level_set_caps_from_attributes
* ext, GstCaps * caps) (GstRTPHeaderExtension * ext, GstCaps * caps)
{ {
GstRTPHeaderExtensionRfc6464 *self = GST_RTP_HEADER_EXTENSION_RFC6464 (ext); GstRTPHeaderExtensionClientAudioLevel *self =
GST_RTP_HEADER_EXTENSION_CLIENT_AUDIO_LEVEL (ext);
const gchar *vad; const gchar *vad;
if (self->vad) if (self->vad)
@ -146,7 +150,7 @@ gst_rtp_header_extension_rfc6464_set_caps_from_attributes (GstRTPHeaderExtension
} }
static gssize static gssize
gst_rtp_header_extension_rfc6464_write (GstRTPHeaderExtension * ext, gst_rtp_header_extension_client_audio_level_write (GstRTPHeaderExtension * ext,
const GstBuffer * input_meta, GstRTPHeaderExtensionFlags write_flags, const GstBuffer * input_meta, GstRTPHeaderExtensionFlags write_flags,
GstBuffer * output, guint8 * data, gsize size) GstBuffer * output, guint8 * data, gsize size)
{ {
@ -154,9 +158,10 @@ gst_rtp_header_extension_rfc6464_write (GstRTPHeaderExtension * ext,
guint level; guint level;
g_return_val_if_fail (size >= g_return_val_if_fail (size >=
gst_rtp_header_extension_rfc6464_get_max_size (ext, NULL), -1); gst_rtp_header_extension_client_audio_level_get_max_size (ext, NULL), -1);
g_return_val_if_fail (write_flags & g_return_val_if_fail (write_flags &
gst_rtp_header_extension_rfc6464_get_supported_flags (ext), -1); gst_rtp_header_extension_client_audio_level_get_supported_flags (ext),
-1);
meta = gst_buffer_get_audio_level_meta ((GstBuffer *) input_meta); meta = gst_buffer_get_audio_level_meta ((GstBuffer *) input_meta);
if (!meta) { if (!meta) {
@ -184,7 +189,7 @@ gst_rtp_header_extension_rfc6464_write (GstRTPHeaderExtension * ext,
} }
static gboolean static gboolean
gst_rtp_header_extension_rfc6464_read (GstRTPHeaderExtension * ext, gst_rtp_header_extension_client_audio_level_read (GstRTPHeaderExtension * ext,
GstRTPHeaderExtensionFlags read_flags, const guint8 * data, gsize size, GstRTPHeaderExtensionFlags read_flags, const guint8 * data, gsize size,
GstBuffer * buffer) GstBuffer * buffer)
{ {
@ -192,7 +197,8 @@ gst_rtp_header_extension_rfc6464_read (GstRTPHeaderExtension * ext,
gboolean voice_activity; gboolean voice_activity;
g_return_val_if_fail (read_flags & g_return_val_if_fail (read_flags &
gst_rtp_header_extension_rfc6464_get_supported_flags (ext), -1); gst_rtp_header_extension_client_audio_level_get_supported_flags (ext),
-1);
/* Both one & two byte use the same format, the second byte being padding */ /* Both one & two byte use the same format, the second byte being padding */
level = data[0] & 0x7F; level = data[0] & 0x7F;
@ -207,8 +213,8 @@ gst_rtp_header_extension_rfc6464_read (GstRTPHeaderExtension * ext,
} }
static void static void
gst_rtp_header_extension_rfc6464_class_init (GstRTPHeaderExtensionRfc6464Class * gst_rtp_header_extension_client_audio_level_class_init
klass) (GstRTPHeaderExtensionClientAudioLevelClass * klass)
{ {
GstRTPHeaderExtensionClass *rtp_hdr_class; GstRTPHeaderExtensionClass *rtp_hdr_class;
GstElementClass *gstelement_class; GstElementClass *gstelement_class;
@ -218,10 +224,11 @@ gst_rtp_header_extension_rfc6464_class_init (GstRTPHeaderExtensionRfc6464Class *
gobject_class = (GObjectClass *) klass; gobject_class = (GObjectClass *) klass;
gstelement_class = GST_ELEMENT_CLASS (klass); gstelement_class = GST_ELEMENT_CLASS (klass);
gobject_class->get_property = gst_rtp_header_extension_rfc6464_get_property; gobject_class->get_property =
gst_rtp_header_extension_client_audio_level_get_property;
/** /**
* rtphdrextrfc6464:vad: * rtphdrextclientaudiolevel:vad:
* *
* If the vad extension attribute is enabled or not, default to %FALSE. * If the vad extension attribute is enabled or not, default to %FALSE.
* *
@ -233,25 +240,28 @@ gst_rtp_header_extension_rfc6464_class_init (GstRTPHeaderExtensionRfc6464Class *
DEFAULT_VAD, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); DEFAULT_VAD, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
rtp_hdr_class->get_supported_flags = rtp_hdr_class->get_supported_flags =
gst_rtp_header_extension_rfc6464_get_supported_flags; gst_rtp_header_extension_client_audio_level_get_supported_flags;
rtp_hdr_class->get_max_size = gst_rtp_header_extension_rfc6464_get_max_size; rtp_hdr_class->get_max_size =
gst_rtp_header_extension_client_audio_level_get_max_size;
rtp_hdr_class->set_attributes = rtp_hdr_class->set_attributes =
gst_rtp_header_extension_rfc6464_set_attributes; gst_rtp_header_extension_client_audio_level_set_attributes;
rtp_hdr_class->set_caps_from_attributes = rtp_hdr_class->set_caps_from_attributes =
gst_rtp_header_extension_rfc6464_set_caps_from_attributes; gst_rtp_header_extension_client_audio_level_set_caps_from_attributes;
rtp_hdr_class->write = gst_rtp_header_extension_rfc6464_write; rtp_hdr_class->write = gst_rtp_header_extension_client_audio_level_write;
rtp_hdr_class->read = gst_rtp_header_extension_rfc6464_read; rtp_hdr_class->read = gst_rtp_header_extension_client_audio_level_read;
gst_element_class_set_static_metadata (gstelement_class, gst_element_class_set_static_metadata (gstelement_class,
"Client-to-Mixer Audio Level Indication (RFC6464) RTP Header Extension", "Client-to-Mixer Audio Level Indication (RFC6464) RTP Header Extension",
GST_RTP_HDREXT_ELEMENT_CLASS, GST_RTP_HDREXT_ELEMENT_CLASS,
"Client-to-Mixer Audio Level Indication (RFC6464) RTP Header Extension", "Client-to-Mixer Audio Level Indication (RFC6464) RTP Header Extension",
"Guillaume Desmottes <guillaume.desmottes@collabora.com>"); "Guillaume Desmottes <guillaume.desmottes@collabora.com>");
gst_rtp_header_extension_class_set_uri (rtp_hdr_class, RFC6464_HDR_EXT_URI); gst_rtp_header_extension_class_set_uri (rtp_hdr_class,
CLIENT_AUDIO_LEVEL_HDR_EXT_URI);
} }
static void static void
gst_rtp_header_extension_rfc6464_init (GstRTPHeaderExtensionRfc6464 * self) gst_rtp_header_extension_client_audio_level_init
(GstRTPHeaderExtensionClientAudioLevel * self)
{ {
GST_DEBUG_OBJECT (self, "creating element"); GST_DEBUG_OBJECT (self, "creating element");
self->vad = DEFAULT_VAD; self->vad = DEFAULT_VAD;

View file

@ -13,20 +13,20 @@
* Library General Public License for more * Library General Public License for more
*/ */
#ifndef __GST_RTPHDREXT_RFC6464_H__ #ifndef __GST_RTPHDREXT_CLIENT_AUDIO_LEVEL_H__
#define __GST_RTPHDREXT_RFC6464_H__ #define __GST_RTPHDREXT_CLIENT_AUDIO_LEVEL_H__
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/rtp/gstrtphdrext.h> #include <gst/rtp/gstrtphdrext.h>
G_BEGIN_DECLS G_BEGIN_DECLS
#define GST_TYPE_RTP_HEADER_EXTENSION_RFC6464 (gst_rtp_header_extension_rfc6464_get_type()) #define GST_TYPE_RTP_HEADER_EXTENSION_CLIENT_AUDIO_LEVEL (gst_rtp_header_extension_client_audio_level_get_type())
G_DECLARE_FINAL_TYPE (GstRTPHeaderExtensionRfc6464, gst_rtp_header_extension_rfc6464, GST, RTP_HEADER_EXTENSION_RFC6464, GstRTPHeaderExtension) G_DECLARE_FINAL_TYPE (GstRTPHeaderExtensionClientAudioLevel, gst_rtp_header_extension_client_audio_level, GST, RTP_HEADER_EXTENSION_CLIENT_AUDIO_LEVEL, GstRTPHeaderExtension)
GST_ELEMENT_REGISTER_DECLARE (rtphdrextrfc6464); GST_ELEMENT_REGISTER_DECLARE (rtphdrextclientaudiolevel);
G_END_DECLS G_END_DECLS
#endif /* __GST_RTPHDREXT_RFC6464_H__ */ #endif /* __GST_RTPHDREXT_CLIENT_AUDIO_LEVEL_H__ */

View file

@ -35,7 +35,7 @@
#include "gstrtpst2022-1-fecdec.h" #include "gstrtpst2022-1-fecdec.h"
#include "gstrtpst2022-1-fecenc.h" #include "gstrtpst2022-1-fecenc.h"
#include "gstrtphdrext-twcc.h" #include "gstrtphdrext-twcc.h"
#include "gstrtphdrext-rfc6464.h" #include "gstrtphdrext-clientaudiolevel.h"
static gboolean static gboolean
plugin_init (GstPlugin * plugin) plugin_init (GstPlugin * plugin)
@ -56,7 +56,7 @@ plugin_init (GstPlugin * plugin)
ret |= GST_ELEMENT_REGISTER (rtpst2022_1_fecdec, plugin); ret |= GST_ELEMENT_REGISTER (rtpst2022_1_fecdec, plugin);
ret |= GST_ELEMENT_REGISTER (rtpst2022_1_fecenc, plugin); ret |= GST_ELEMENT_REGISTER (rtpst2022_1_fecenc, plugin);
ret |= GST_ELEMENT_REGISTER (rtphdrexttwcc, plugin); ret |= GST_ELEMENT_REGISTER (rtphdrexttwcc, plugin);
ret |= GST_ELEMENT_REGISTER (rtphdrextrfc6464, plugin); ret |= GST_ELEMENT_REGISTER (rtphdrextclientaudiolevel, plugin);
return ret; return ret;
} }

View file

@ -4,7 +4,7 @@ rtpmanager_sources = [
'gstrtpdtmfmux.c', 'gstrtpdtmfmux.c',
'gstrtpjitterbuffer.c', 'gstrtpjitterbuffer.c',
'gstrtphdrext-twcc.c', 'gstrtphdrext-twcc.c',
'gstrtphdrext-rfc6464.c', 'gstrtphdrext-clientaudiolevel.c',
'gstrtpmux.c', 'gstrtpmux.c',
'gstrtpptdemux.c', 'gstrtpptdemux.c',
'gstrtprtxqueue.c', 'gstrtprtxqueue.c',

View file

@ -98,7 +98,7 @@ check_caps (GstRTPHeaderExtension * ext, gboolean vad)
gst_caps_unref (caps); gst_caps_unref (caps);
} }
GST_START_TEST (rtprfc6464_sdp) GST_START_TEST (rtphdrext_client_audio_level_sdp)
{ {
GstRTPHeaderExtension *ext; GstRTPHeaderExtension *ext;
GstCaps *caps; GstCaps *caps;
@ -140,7 +140,7 @@ GST_START_TEST (rtprfc6464_sdp)
GST_END_TEST; GST_END_TEST;
GST_START_TEST (rtprfc6464_one_byte) GST_START_TEST (rtphdrext_client_audio_level_one_byte)
{ {
GstRTPHeaderExtension *ext; GstRTPHeaderExtension *ext;
GstRTPHeaderExtensionFlags flags; GstRTPHeaderExtensionFlags flags;
@ -188,7 +188,7 @@ GST_START_TEST (rtprfc6464_one_byte)
GST_END_TEST; GST_END_TEST;
GST_START_TEST (rtprfc6464_two_bytes) GST_START_TEST (rtphdrext_client_audio_level_two_bytes)
{ {
GstRTPHeaderExtension *ext; GstRTPHeaderExtension *ext;
GstRTPHeaderExtensionFlags flags; GstRTPHeaderExtensionFlags flags;
@ -236,7 +236,7 @@ GST_START_TEST (rtprfc6464_two_bytes)
GST_END_TEST; GST_END_TEST;
GST_START_TEST (rtprfc6464_no_meta) GST_START_TEST (rtphdrext_client_audio_level_no_meta)
{ {
GstRTPHeaderExtension *ext; GstRTPHeaderExtension *ext;
GstBuffer *buffer; GstBuffer *buffer;
@ -271,7 +271,7 @@ GST_START_TEST (rtprfc6464_no_meta)
GST_END_TEST; GST_END_TEST;
GST_START_TEST (rtprfc6464_payloader_depayloader) GST_START_TEST (rtphdrext_client_audio_level_payloader_depayloader)
{ {
GstHarness *h; GstHarness *h;
GstBuffer *b; GstBuffer *b;
@ -304,7 +304,7 @@ GST_START_TEST (rtprfc6464_payloader_depayloader)
GST_END_TEST; GST_END_TEST;
GST_START_TEST (rtprfc6464_payloader_api) GST_START_TEST (rtphdrext_client_audio_level_payloader_api)
{ {
GstHarness *h; GstHarness *h;
GstRTPHeaderExtension *ext; GstRTPHeaderExtension *ext;
@ -350,21 +350,21 @@ GST_END_TEST;
static Suite * static Suite *
rtprfc6464_suite (void) rtphdrext_client_audio_level_suite (void)
{ {
Suite *s = suite_create ("rtprfc6464"); Suite *s = suite_create ("rtphdrext_client_audio_level");
TCase *tc_chain = tcase_create ("general"); TCase *tc_chain = tcase_create ("general");
suite_add_tcase (s, tc_chain); suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, rtprfc6464_sdp); tcase_add_test (tc_chain, rtphdrext_client_audio_level_sdp);
tcase_add_test (tc_chain, rtprfc6464_one_byte); tcase_add_test (tc_chain, rtphdrext_client_audio_level_one_byte);
tcase_add_test (tc_chain, rtprfc6464_two_bytes); tcase_add_test (tc_chain, rtphdrext_client_audio_level_two_bytes);
tcase_add_test (tc_chain, rtprfc6464_no_meta); tcase_add_test (tc_chain, rtphdrext_client_audio_level_no_meta);
tcase_add_test (tc_chain, rtprfc6464_payloader_depayloader); tcase_add_test (tc_chain, rtphdrext_client_audio_level_payloader_depayloader);
tcase_add_test (tc_chain, rtprfc6464_payloader_api); tcase_add_test (tc_chain, rtphdrext_client_audio_level_payloader_api);
return s; return s;
} }
GST_CHECK_MAIN (rtprfc6464) GST_CHECK_MAIN (rtphdrext_client_audio_level)

View file

@ -73,7 +73,7 @@ good_tests = [
[ 'elements/rtpbin_buffer_list' ], [ 'elements/rtpbin_buffer_list' ],
[ 'elements/rtpcollision' ], [ 'elements/rtpcollision' ],
[ 'elements/rtpfunnel' ], [ 'elements/rtpfunnel' ],
[ 'elements/rtphdrextrfc6464', false, [gstsdp_dep, gstaudio_dep] ], [ 'elements/rtphdrextclientaudiolevel', false, [gstsdp_dep, gstaudio_dep] ],
[ 'elements/rtpjitterbuffer' ], [ 'elements/rtpjitterbuffer' ],
[ 'elements/rtpjpeg' ], [ 'elements/rtpjpeg' ],