From dec668cef87141909689b3f7bad5ad6e4c18eaf0 Mon Sep 17 00:00:00 2001 From: namsgit Date: Thu, 23 Jan 2025 14:45:11 +0530 Subject: [PATCH 1/3] process sctp in one go --- src/peer_connection.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/peer_connection.c b/src/peer_connection.c index 069b0cf..7b4ca90 100644 --- a/src/peer_connection.c +++ b/src/peer_connection.c @@ -470,7 +470,7 @@ int peer_connection_loop(PeerConnection* pc) { } #endif - if ((pc->agent_ret = agent_recv(&pc->agent, pc->agent_buf, sizeof(pc->agent_buf))) > 0) { + while ((pc->agent_ret = agent_recv(&pc->agent, pc->agent_buf, sizeof(pc->agent_buf))) > 0) { LOGD("agent_recv %d", pc->agent_ret); if (rtcp_probe(pc->agent_buf, pc->agent_ret)) { @@ -484,6 +484,7 @@ int peer_connection_loop(PeerConnection* pc) { if (ret > 0) { sctp_incoming_data(&pc->sctp, (char*)pc->temp_buf, ret); + continue; } } else if (rtp_packet_validate(pc->agent_buf, pc->agent_ret)) { @@ -501,9 +502,10 @@ int peer_connection_loop(PeerConnection* pc) { } else { LOGW("Unknown data"); } + break; } - if (KEEPALIVE_CONNCHECK > 0 && (ports_get_epoch_time() - pc->agent.binding_request_time) > KEEPALIVE_CONNCHECK) { + if (CONFIG_KEEPALIVE_TIMEOUT > 0 && (ports_get_epoch_time() - pc->agent.binding_request_time) > CONFIG_KEEPALIVE_TIMEOUT) { LOGI("binding request timeout"); STATE_CHANGED(pc, PEER_CONNECTION_CLOSED); } @@ -653,3 +655,4 @@ int peer_connection_add_ice_candidate(PeerConnection* pc, char* candidate) { agent->remote_candidates_count++; return 0; } + From c518a9afaf10dac6654ea3831a8c6cacaaa73310 Mon Sep 17 00:00:00 2001 From: namsgit Date: Thu, 23 Jan 2025 14:46:49 +0530 Subject: [PATCH 2/3] revert unitended change --- src/peer_connection.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/peer_connection.c b/src/peer_connection.c index 7b4ca90..5da5f16 100644 --- a/src/peer_connection.c +++ b/src/peer_connection.c @@ -505,7 +505,7 @@ int peer_connection_loop(PeerConnection* pc) { break; } - if (CONFIG_KEEPALIVE_TIMEOUT > 0 && (ports_get_epoch_time() - pc->agent.binding_request_time) > CONFIG_KEEPALIVE_TIMEOUT) { + if (KEEPALIVE_TIMEOUT > 0 && (ports_get_epoch_time() - pc->agent.binding_request_time) > KEEPALIVE_TIMEOUT) { LOGI("binding request timeout"); STATE_CHANGED(pc, PEER_CONNECTION_CLOSED); } From 04bfe48736a0ba948709e6ac5d6e90b62d459806 Mon Sep 17 00:00:00 2001 From: namsgit Date: Thu, 23 Jan 2025 14:58:12 +0530 Subject: [PATCH 3/3] fix --- src/peer_connection.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/peer_connection.c b/src/peer_connection.c index 5da5f16..c942db8 100644 --- a/src/peer_connection.c +++ b/src/peer_connection.c @@ -505,7 +505,7 @@ int peer_connection_loop(PeerConnection* pc) { break; } - if (KEEPALIVE_TIMEOUT > 0 && (ports_get_epoch_time() - pc->agent.binding_request_time) > KEEPALIVE_TIMEOUT) { + if (KEEPALIVE_CONNCHECK > 0 && (ports_get_epoch_time() - pc->agent.binding_request_time) > KEEPALIVE_CONNCHECK) { LOGI("binding request timeout"); STATE_CHANGED(pc, PEER_CONNECTION_CLOSED); }