]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11919: [core] add api compatibility for switch_rtp_new
authorMike Jerris <mike@signalwire.com>
Mon, 8 Jul 2019 19:16:54 +0000 (15:16 -0400)
committerMike Jerris <mike@signalwire.com>
Wed, 17 Jul 2019 20:43:34 +0000 (16:43 -0400)
src/include/switch_rtp.h
src/mod/applications/mod_esf/mod_esf.c
src/mod/applications/mod_oreka/mod_oreka.c
src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c
src/mod/endpoints/mod_dingaling/mod_dingaling.c
src/mod/endpoints/mod_h323/mod_h323.cpp
src/mod/endpoints/mod_skinny/skinny_server.c
src/mod/endpoints/mod_sofia/rtp.c
src/switch_core_media.c
src/switch_rtp.c

index a16c5f6d5a7502cf6bac007c8e9de74b37e5505d..12f0626ccff07b37af54c31c7451b0c460128620 100644 (file)
@@ -48,6 +48,8 @@ SWITCH_BEGIN_EXTERN_C
 //#define SWITCH_RTP_CRYPTO_KEY_32 "AES_CM_128_HMAC_SHA1_32"
 #define SWITCH_RTP_CRYPTO_KEY_80 "AES_CM_128_HMAC_SHA1_80"
 
+#define SWITCH_RTP_BUNDLE_INTERNAL_PT 21
+
 typedef struct {
        switch_rtp_hdr_t header;
        char body[SWITCH_RTP_MAX_BUF_LEN+4+sizeof(char *)];
@@ -248,6 +250,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session
   \param timer_name timer interface to use
   \param err a pointer to resolve error messages
   \param pool a memory pool to use for the session
+  \param bundle_port port used by bundled stream locally, for video thread this is the port where it will forward audio (internal bundle port on which audio is listening), and for audio this is the port where it will send RTP (external bundle port where video is listening)
   \return the new RTP session or NULL on failure
 */
 SWITCH_DECLARE(switch_rtp_t *) switch_rtp_new(const char *rx_host,
@@ -257,7 +260,7 @@ SWITCH_DECLARE(switch_rtp_t *) switch_rtp_new(const char *rx_host,
                                                                                          switch_payload_t payload,
                                                                                          uint32_t samples_per_interval,
                                                                                          uint32_t ms_per_packet,
-                                                                                         switch_rtp_flag_t flags[], char *timer_name, const char **err, switch_memory_pool_t *pool);
+                                                                                         switch_rtp_flag_t flags[], char *timer_name, const char **err, switch_memory_pool_t *pool, switch_port_t bundle_internal_ports, switch_port_t bundle_external_port);
 
 
 /*!
index 4ac8e160714b11589107d16a2beb7f1343f28b33..03801961b1a248e4aa34f35eb5305d1a6cc336a2 100644 (file)
@@ -392,7 +392,7 @@ SWITCH_STANDARD_APP(bcast_function)
                                                                         mcast_port,
                                                                         alert_packet->audio_header.codec,
                                                                         160,
-                                                                        20000, flags, "soft", &err, switch_core_session_get_pool(session));
+                                                                        20000, flags, "soft", &err, switch_core_session_get_pool(session), 0, 0);
 
                if (!switch_rtp_ready(rtp_session)) {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "RTP Error\n");
index 4ebf1759d939cf76f58fd2ba20f3d9a66d4a32ca..cae606a9bff5ea0f0f38241781c589ee8d75ffea 100644 (file)
@@ -147,7 +147,7 @@ static int oreka_setup_rtp(oreka_session_t *oreka, oreka_stream_type_t type)
                        0, /* PCMU IANA*/
                        codec_impl->samples_per_packet,
                        codec_impl->microseconds_per_packet,
-                       flags, NULL, &err, switch_core_session_get_pool(oreka->session));
+                                                               flags, NULL, &err, switch_core_session_get_pool(oreka->session), 0, 0);
        if (!rtp_stream) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create %s RTP stream at %s:%d: %s\n",
                                type_str, globals.local_ipv4_str, rtp_port, err);
index 506df4c4c8ec8dadfbd88e4586fc89dab0af6b5c..0eb9eac2feb92029f548d4451487ad0bda45a79d 100644 (file)
@@ -289,7 +289,7 @@ static int sangoma_create_rtp(void *usr_priv, sngtc_codec_request_leg_t *codec_r
                        iana,
                        sess->impl->samples_per_packet,
                        codec_req_leg->ms * 1000, /* microseconds per packet */
-                       flags, NULL, &err, sesspool);
+                                                                flags, NULL, &err, sesspool, 0, 0);
 
        if (!rtp_session) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to create switch rtp session: %s\n", err);
index 271719035522e559c81b92726bdecd52047abfdf..8ab56c5da107356e48d1741c7a030498f01f29a3 100644 (file)
@@ -1266,7 +1266,7 @@ static int activate_audio_rtp(struct private_object *tech_pvt)
                                                                                                                                                   tech_pvt->transports[LDL_TPORT_RTP].codec_num,
                                                                                                                                                   tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->samples_per_packet,
                                                                                                                                                   tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->microseconds_per_packet,
-                                                                                                                                                  flags, tech_pvt->profile->timer_name, &err, switch_core_session_get_pool(tech_pvt->session)))) {
+                                                                                                                                                  flags, tech_pvt->profile->timer_name, &err, switch_core_session_get_pool(tech_pvt->session), 0, 0))) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "RTP ERROR %s\n", err);
                switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                r = 0;
@@ -1459,7 +1459,7 @@ static int activate_video_rtp(struct private_object *tech_pvt)
                                                                                                                                                                 tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_num,
                                                                                                                                                                 1,
                                                                                                                                                                 90000,
-                                                                                                                                                                flags, NULL, &err, switch_core_session_get_pool(tech_pvt->session)))) {
+                                                                                                                                                                flags, NULL, &err, switch_core_session_get_pool(tech_pvt->session), 0, 0))) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "RTP ERROR %s\n", err);
                switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                r = 0; goto end;
index 3581f0e0b7ec7e80f92bdf3eac9b41e0f3caf1cf..c6dc7fc9e91f9032275fc04f1ab8f7899261e823 100644 (file)
@@ -2200,7 +2200,7 @@ PBoolean FSH323_ExternalRTPChannel::Start()
                                                        codec->implementation->samples_per_packet,
                                                        codec->implementation->microseconds_per_packet,
                                                        flags, timer_name, &err,
-                                                       switch_core_session_get_pool(m_fsSession));
+                                                      switch_core_session_get_pool(m_fsSession), 0, 0);
 
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------------->tech_pvt->rtp_session = %p\n",tech_pvt->rtp_session);
                m_conn->m_startRTP = true;
index 86b4730786c783c840d4e234ba58b993ff4b3b45..dd76626343eb484c3adfd07f85d9a7c33cda495f 100644 (file)
@@ -2064,7 +2064,7 @@ switch_status_t skinny_handle_open_receive_channel_ack_message(listener_t *liste
                                tech_pvt->read_impl.samples_per_packet,
                                tech_pvt->codec_ms * 1000,
                                flags, "soft", &err,
-                               switch_core_session_get_pool(session));
+                               switch_core_session_get_pool(session), 0, 0);
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG,
                                "AUDIO RTP [%s] %s:%d->%s:%d codec: %u ms: %d [%s]\n",
                                switch_channel_get_name(channel),
index 7261b38f1abf2f373be27bdc8ee12fec4fafcd4f..c5e9751029d3935a6db101174a5e933a9bf93ac7 100644 (file)
@@ -266,7 +266,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
 
     if (!(tech_pvt->rtp_session = switch_rtp_new(local_addr, local_port, remote_addr, remote_port, tech_pvt->agreed_pt,
                                                                                                 tech_pvt->read_codec.implementation->samples_per_packet, ptime * 1000,
-                                                                                                rtp_flags, "soft", &err, switch_core_session_get_pool(*new_session)))) {
+                                                                                                rtp_flags, "soft", &err, switch_core_session_get_pool(*new_session), 0, 0))) {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't setup RTP session: [%s]\n", err);
         goto fail;
     }
index e7bce84b437ef6aa9fbab350b2a17df52a91dbc2..2b026f03fd988bea40baadf51c879dfacaf89fec 100644 (file)
@@ -8671,7 +8671,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                                                                           a_engine->cur_payload_map->pt,
                                                                                           a_engine->read_impl.samples_per_packet,
                                                                                           a_engine->cur_payload_map->codec_ms * 1000,
-                                                                                          flags, timer_name, &err, switch_core_session_get_pool(session));
+                                                                                          flags, timer_name, &err, switch_core_session_get_pool(session),
+                                                                                          0, 0);
 
                if (switch_rtp_ready(a_engine->rtp_session)) {
                        switch_rtp_set_payload_map(a_engine->rtp_session, &a_engine->payload_map);
@@ -9077,7 +9078,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                                                                                   t_engine->cur_payload_map->remote_sdp_ip,
                                                                                                   t_engine->cur_payload_map->remote_sdp_port,
                                                                                                   t_engine->cur_payload_map->pt,
-                                                                                                  TEXT_TIMER_SAMPLES, TEXT_TIMER_MS * 1000, flags, NULL, &err, switch_core_session_get_pool(session));
+                                                                                                  TEXT_TIMER_SAMPLES, TEXT_TIMER_MS * 1000, flags, NULL, &err, switch_core_session_get_pool(session),
+                                                                                                  0, 0);
 
 
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%sTEXT RTP [%s] %s:%d->%s:%d codec: %u ms: %d [%s]\n",
@@ -9406,7 +9408,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                                                                                                 v_engine->cur_payload_map->remote_sdp_ip,
                                                                                                                 v_engine->cur_payload_map->remote_sdp_port,
                                                                                                                 v_engine->cur_payload_map->pt,
-                                                                                                                1, 90000, flags, NULL, &err, switch_core_session_get_pool(session));
+                                                                                                                1, 90000, flags, NULL, &err, switch_core_session_get_pool(session),
+                                                                                                                0, 0);
 
 
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%sVIDEO RTP [%s] %s:%d->%s:%d codec: %u ms: %d [%s]\n",
index 98e621882e851bb1afc1320e0627a1be3952ec05..2b06c448d41d82dc53dfbe9a5112b493fffadd9b 100644 (file)
@@ -389,7 +389,7 @@ struct switch_rtp {
        switch_time_t last_write_timestamp;
        uint32_t flags[SWITCH_RTP_FLAG_INVALID];
        switch_memory_pool_t *pool;
-       switch_sockaddr_t *from_addr, *rtp_from_addr, *rtcp_from_addr;
+       switch_sockaddr_t *from_addr, *rtp_from_addr, *rtcp_from_addr, *bundle_internal_addr, *bundle_external_addr;
        char *rx_host;
        switch_port_t rx_port;
        switch_rtp_ice_t ice;
@@ -2155,7 +2155,7 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
                        rtcp_bytes += sizeof(struct switch_rtcp_report_block);
                        rtcp_generate_report_block(rtp_session, rtcp_report_block, nack_dup);
                        rtp_session->rtcp_send_msg.header.count = 1; /* reception report block count */
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "Sending RTCP RR");
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_NOTICE, "Sending RTCP RR (ssrc=%u)\n", rtp_session->ssrc);
                } else {
                        struct switch_rtcp_sender_info *rtcp_sender_info;
                        rtp_session->rtcp_send_msg.header.type = _RTCP_PT_SR; /* Sender report */
@@ -2173,7 +2173,7 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
                                rtcp_generate_report_block(rtp_session, rtcp_report_block, nack_dup);
                                rtp_session->rtcp_send_msg.header.count = 1; /* reception report block count */
                        }
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "Sending RTCP SR");
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_NOTICE, "Sending RTCP SR (ssrc=%u)\n", rtp_session->ssrc);
                }
 
                rtp_session->rtcp_send_msg.header.length = htons((uint16_t)(rtcp_bytes / 4) - 1);
@@ -4509,7 +4509,9 @@ SWITCH_DECLARE(switch_rtp_t *) switch_rtp_new(const char *rx_host,
                                                                                          switch_payload_t payload,
                                                                                          uint32_t samples_per_interval,
                                                                                          uint32_t ms_per_packet,
-                                                                                         switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID], char *timer_name, const char **err, switch_memory_pool_t *pool)
+                                                                                         switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID], char *timer_name, const char **err, switch_memory_pool_t *pool,
+                                              switch_port_t bundle_internal_port,
+                                              switch_port_t bundle_external_port)
 {
        switch_rtp_t *rtp_session = NULL;