FS-11919: [core] add api compatibility for switch_rtp_new

This commit is contained in:
Mike Jerris 2019-07-08 15:16:54 -04:00
parent 4926eac49d
commit 7906a2054a
10 changed files with 24 additions and 16 deletions

View 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);
/*!

View 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");

View 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);

View 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);

View 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;

View 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;

View 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),

View 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;
}

View 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",

View 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;