mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 13:12:03 +00:00
convert rtp flags to arrays
This commit is contained in:
@@ -260,8 +260,8 @@ 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,
|
||||
0, "soft", &err, switch_core_session_get_pool(*new_session)))) {
|
||||
tech_pvt->read_codec.implementation->samples_per_packet, ptime * 1000,
|
||||
0, "soft", &err, switch_core_session_get_pool(*new_session)))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't setup RTP session: [%s]\n", err);
|
||||
goto fail;
|
||||
}
|
||||
@@ -557,20 +557,23 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
|
||||
case SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO:
|
||||
{
|
||||
if (switch_rtp_ready(tech_pvt->rtp_session) && !zstr(msg->string_array_arg[0]) && !zstr(msg->string_array_arg[1])) {
|
||||
int32_t flags = 0;
|
||||
switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID] = {0};
|
||||
int x = 0;
|
||||
|
||||
if (!strcasecmp(msg->string_array_arg[0], "read")) {
|
||||
flags |= SWITCH_RTP_FLAG_DEBUG_RTP_READ;
|
||||
flags[SWITCH_RTP_FLAG_DEBUG_RTP_READ]++;x++;
|
||||
} else if (!strcasecmp(msg->string_array_arg[0], "write")) {
|
||||
flags |= SWITCH_RTP_FLAG_DEBUG_RTP_WRITE;
|
||||
flags[SWITCH_RTP_FLAG_DEBUG_RTP_WRITE]++;x++;
|
||||
} else if (!strcasecmp(msg->string_array_arg[0], "both")) {
|
||||
flags |= SWITCH_RTP_FLAG_DEBUG_RTP_READ | SWITCH_RTP_FLAG_DEBUG_RTP_WRITE;
|
||||
flags[SWITCH_RTP_FLAG_DEBUG_RTP_READ]++;x++;
|
||||
flags[SWITCH_RTP_FLAG_DEBUG_RTP_WRITE]++;
|
||||
}
|
||||
|
||||
if (flags) {
|
||||
if (x) {
|
||||
if (switch_true(msg->string_array_arg[1])) {
|
||||
switch_rtp_set_flag(tech_pvt->rtp_session, flags);
|
||||
switch_rtp_set_flags(tech_pvt->rtp_session, flags);
|
||||
} else {
|
||||
switch_rtp_clear_flag(tech_pvt->rtp_session, flags);
|
||||
switch_rtp_clear_flags(tech_pvt->rtp_session, flags);
|
||||
}
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid Options\n");
|
||||
|
||||
Reference in New Issue
Block a user