mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-13 15:50:59 +00:00
add reset function to clear some state data in the rtp session
This commit is contained in:
parent
280e816a90
commit
c0e7e7b88c
@ -218,6 +218,7 @@ SWITCH_DECLARE(void) switch_rtp_reset_media_timer(switch_rtp_t *rtp_session);
|
||||
SWITCH_DECLARE(void) switch_rtp_set_max_missed_packets(switch_rtp_t *rtp_session, uint32_t max);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_rtp_udptl_mode(switch_rtp_t *rtp_session);
|
||||
SWITCH_DECLARE(void) switch_rtp_reset(switch_rtp_t *rtp_session);
|
||||
|
||||
/*!
|
||||
\brief Assign a local address to the RTP session
|
||||
|
@ -1634,7 +1634,6 @@ static void verto_set_media_options(verto_pvt_t *tech_pvt, verto_profile_t *prof
|
||||
//tech_pvt->mparams->manual_rtp_bugs = profile->manual_rtp_bugs;
|
||||
//tech_pvt->mparams->manual_video_rtp_bugs = profile->manual_video_rtp_bugs;
|
||||
|
||||
|
||||
tech_pvt->mparams->local_network = switch_core_session_strdup(tech_pvt->session, profile->local_network);
|
||||
|
||||
|
||||
@ -2382,6 +2381,10 @@ static switch_bool_t verto__attach_func(const char *method, cJSON *params, jsock
|
||||
switch_core_media_clear_ice(tech_pvt->session);
|
||||
switch_channel_set_flag(tech_pvt->channel, CF_REINVITE);
|
||||
|
||||
//switch_channel_audio_sync(tech_pvt->channel);
|
||||
//switch_channel_set_flag(tech_pvt->channel, CF_VIDEO_BREAK);
|
||||
//switch_core_session_kill_channel(tech_pvt->session, SWITCH_SIG_BREAK);
|
||||
|
||||
if ((match = switch_core_media_negotiate_sdp(tech_pvt->session, tech_pvt->r_sdp, &p, SDP_TYPE_RESPONSE))) {
|
||||
if (switch_core_media_activate_rtp(tech_pvt->session) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "MEDIA ERROR");
|
||||
|
@ -2395,6 +2395,10 @@ static void clear_ice(switch_core_session_t *session, switch_media_type_t type)
|
||||
memset(&engine->ice_in, 0, sizeof(engine->ice_in));
|
||||
engine->remote_rtcp_port = 0;
|
||||
|
||||
if (engine->rtp_session) {
|
||||
switch_rtp_reset(engine->rtp_session);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//?
|
||||
|
@ -543,8 +543,6 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
|
||||
rtp_session->stats.inbound.last_processed_seq = 0;
|
||||
|
||||
if (!(packet[0] || packet[1] || packet[2] || packet[3]) && len >= 8) {
|
||||
|
||||
|
||||
packet += 4;
|
||||
len -= 4;
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "DTMF payload offset by 4 bytes.\n");
|
||||
@ -2458,6 +2456,18 @@ SWITCH_DECLARE(void) switch_rtp_set_max_missed_packets(switch_rtp_t *rtp_session
|
||||
rtp_session->max_missed_packets = max;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(void) switch_rtp_reset(switch_rtp_t *rtp_session)
|
||||
{
|
||||
if (!rtp_session) {
|
||||
return;
|
||||
}
|
||||
|
||||
rtp_session->seq = (uint16_t) rand();
|
||||
rtp_session->ts = 0;
|
||||
memset(&rtp_session->ts_norm, 0, sizeof(rtp_session->ts_norm));
|
||||
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(void) switch_rtp_reset_media_timer(switch_rtp_t *rtp_session)
|
||||
{
|
||||
rtp_session->missed_count = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user