[Core] Add handling of sendrcv flag for RFC4103 Real-Time Text (RTT). Fix bug that always used RTP RED, even when not advertised by peer leading to garbled text.

This commit is contained in:
leecher1337 2025-01-13 12:33:52 +01:00
parent 52617a0a3b
commit 6d4776e178
1 changed files with 20 additions and 1 deletions

View File

@ -3234,7 +3234,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
if (type == SWITCH_MEDIA_TYPE_TEXT && !switch_test_flag((&engine->read_frame), SFF_CNG)) { if (type == SWITCH_MEDIA_TYPE_TEXT && !switch_test_flag((&engine->read_frame), SFF_CNG)) {
if (engine->red_pt) { if (engine->red_pt == engine->read_frame.payload) {
unsigned char *p = engine->read_frame.data; unsigned char *p = engine->read_frame.data;
*(p + engine->read_frame.datalen) = '\0'; *(p + engine->read_frame.datalen) = '\0';
@ -5892,6 +5892,25 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
got_text++; got_text++;
switch_core_media_set_rmode(smh->session, SWITCH_MEDIA_TYPE_TEXT, sdp_media_flow(m->m_mode), sdp_type);
if (sdp_type == SDP_TYPE_REQUEST) {
switch(t_engine->rmode) {
case SWITCH_MEDIA_FLOW_RECVONLY:
switch_core_media_set_smode(smh->session, SWITCH_MEDIA_TYPE_TEXT, SWITCH_MEDIA_FLOW_SENDONLY, sdp_type);
break;
case SWITCH_MEDIA_FLOW_SENDONLY:
switch_core_media_set_smode(smh->session, SWITCH_MEDIA_TYPE_TEXT, SWITCH_MEDIA_FLOW_RECVONLY, sdp_type);
break;
case SWITCH_MEDIA_FLOW_INACTIVE:
switch_core_media_set_smode(smh->session, SWITCH_MEDIA_TYPE_TEXT, SWITCH_MEDIA_FLOW_INACTIVE, sdp_type);
break;
default:
switch_core_media_set_smode(smh->session, SWITCH_MEDIA_TYPE_TEXT, SWITCH_MEDIA_FLOW_SENDRECV, sdp_type);
break;
}
}
for (map = m->m_rtpmaps; map; map = map->rm_next) { for (map = m->m_rtpmaps; map; map = map->rm_next) {
payload_map_t *pmap; payload_map_t *pmap;