[vlc-devel] [PATCH] Dynamic rtp configurable payload type
Alessandro Bietresato
alessandro.bietresato at telefin.it
Mon Jan 13 09:08:52 CET 2020
This patch allows to configure rtp payload type
for dynamic rtp via the "dynamic-payload-type" parameter (defaults to 96)
---
modules/stream_out/rtp.c | 18 +++++++++++++++++-
modules/stream_out/rtp.h | 1 +
modules/stream_out/rtpfmt.c | 2 +-
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c
index d4c7460477..ad52b811f5 100644
--- a/modules/stream_out/rtp.c
+++ b/modules/stream_out/rtp.c
@@ -177,6 +177,9 @@ static const char *const ppsz_protocols[] = {
#define RTSP_PASS_LONGTEXT N_("Password that will be " \
"requested to access the stream." )
+#define DYNAMIC_PAYLOAD_TYPE_TEXT N_("Dynamic rtp payload type")
+#define DYNAMIC_PAYLOAD_TYPE_LONGTEXT N_( \
+ "Payload type for dynamic rtp, defaults to 96" )
static int Open ( vlc_object_t * );
static void Close( vlc_object_t * );
@@ -227,6 +230,8 @@ vlc_module_begin ()
RTCP_MUX_TEXT, RTCP_MUX_LONGTEXT, false )
add_integer( SOUT_CFG_PREFIX "caching", MS_FROM_VLC_TICK(DEFAULT_PTS_DELAY),
CACHING_TEXT, CACHING_LONGTEXT, true )
+ add_integer( SOUT_CFG_PREFIX "dynamic-payload-type", 96,
+ DYNAMIC_PAYLOAD_TYPE_TEXT, DYNAMIC_PAYLOAD_TYPE_LONGTEXT, true )
#ifdef HAVE_SRTP
add_string( SOUT_CFG_PREFIX "key", "",
@@ -262,7 +267,7 @@ vlc_module_end ()
static const char *const ppsz_sout_options[] = {
"dst", "name", "cat", "port", "port-audio", "port-video", "*sdp", "ttl",
"mux", "sap", "description", "url", "email",
- "proto", "rtcp-mux", "caching",
+ "proto", "rtcp-mux", "caching", "dynamic-payload-type",
#ifdef HAVE_SRTP
"key", "salt",
#endif
@@ -321,6 +326,7 @@ typedef struct
uint16_t i_port;
uint16_t i_port_audio;
uint16_t i_port_video;
+ uint16_t i_dynamic_payload_type;
uint8_t proto;
bool rtcp_mux;
bool b_latm;
@@ -408,6 +414,7 @@ static int Open( vlc_object_t *p_this )
p_sys->i_port_audio = var_GetInteger( p_stream, SOUT_CFG_PREFIX "port-audio" );
p_sys->i_port_video = var_GetInteger( p_stream, SOUT_CFG_PREFIX "port-video" );
p_sys->rtcp_mux = var_GetBool( p_stream, SOUT_CFG_PREFIX "rtcp-mux" );
+ p_sys->i_dynamic_payload_type = var_GetInteger( p_stream, SOUT_CFG_PREFIX "dynamic-payload-type" );
if( p_sys->i_port_audio && p_sys->i_port_video == p_sys->i_port_audio )
{
@@ -1812,3 +1819,12 @@ void rtp_get_video_geometry( sout_stream_id_sys_t *id, int *width, int *height )
int ret = sscanf( id->rtp_fmt.fmtp, "%*s width=%d; height=%d; ", width, height );
assert( ret == 2 );
}
+
+uint16_t rtp_get_dynamic_payload_type( vlc_object_t *obj )
+{
+ sout_stream_t *p_stream = (sout_stream_t*)obj;
+ assert(p_stream != NULL);
+ sout_stream_sys_t *p_sys = p_stream->p_sys;
+ assert(p_sys != NULL);
+ return p_sys->i_dynamic_payload_type;
+}
diff --git a/modules/stream_out/rtp.h b/modules/stream_out/rtp.h
index 2b1838f679..650ee8b6fd 100644
--- a/modules/stream_out/rtp.h
+++ b/modules/stream_out/rtp.h
@@ -92,6 +92,7 @@ int rtp_get_fmt( vlc_object_t *obj, const es_format_t *p_fmt, const char *mux,
/* Only used by rtp_packetize_rawvideo */
void rtp_get_video_geometry( sout_stream_id_sys_t *id, int *width, int *height );
uint16_t rtp_get_extended_sequence( sout_stream_id_sys_t *id );
+uint16_t rtp_get_dynamic_payload_type( vlc_object_t *obj );
/* VoD */
int OpenVoD ( vlc_object_t * );
diff --git a/modules/stream_out/rtpfmt.c b/modules/stream_out/rtpfmt.c
index 356abd4eb6..6e09305860 100644
--- a/modules/stream_out/rtpfmt.c
+++ b/modules/stream_out/rtpfmt.c
@@ -173,7 +173,7 @@ int rtp_get_fmt( vlc_object_t *obj, const es_format_t *p_fmt, const char *mux,
/* Dynamic payload type. Payload types are scoped to the RTP
* session, and we put each ES in its own session, so no risk of
* conflict. */
- rtp_fmt->payload_type = 96;
+ rtp_fmt->payload_type = rtp_get_dynamic_payload_type(obj);
rtp_fmt->cat = mux != NULL ? VIDEO_ES : p_fmt->i_cat;
if( rtp_fmt->cat == AUDIO_ES )
{
--
2.24.1
--
_Ai sensi del Regolamento UE 679/2016 si precisa che le informazioni
contenute in questo messaggio sono riservate e ad uso esclusivo del
destinatario. Qualora il messaggio in parola Le fosse pervenuto per
errore, La preghiamo di eliminarlo senza copiarlo e di non inoltrarlo a
terzi, dandocene gentilmente comunicazione alla mail info at telefin.it
<mailto:info at telefin.it>. _
_
This message, for the Regulation UE 679/2016,
may contain confidential and/or privileged information. If you are not the
addressee or authorized to receive this for the addressee, you must not
use, copy, disclose or take any action based on this message or any
information herein. If you have received this message in error, please
notify the sender immediately at the following e-mail address
info at telefin.it <mailto:info at telefin.it> and delete this message._
More information about the vlc-devel
mailing list