Skip to content

Commit

Permalink
Do not drop RTP packets with empty payload.
Browse files Browse the repository at this point in the history
  • Loading branch information
atoppi committed Mar 14, 2019
1 parent 7e2222a commit 281116d
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions ice.c
Original file line number Diff line number Diff line change
Expand Up @@ -2282,24 +2282,25 @@ static void janus_ice_cb_nice_recv(NiceAgent *agent, guint stream_id, guint comp
char *payload = janus_rtp_payload(buf, buflen, &plen);
if (!payload) {
JANUS_LOG(LOG_ERR, "[%"SCNu64"] Error accessing the RTP payload len=%d\n", handle->handle_id, buflen);
return;
}
if(rtx) {
/* The original sequence number is in the first two bytes of the payload */
/* Rewrite the header with the info from the original packet (payload type, SSRC, sequence number) */
header->type = stream->video_payload_type;
packet_ssrc = stream->video_ssrc_peer[vindex];
header->ssrc = htonl(packet_ssrc);
memcpy(&header->seq_number, payload, 2);
/* Finally, remove the original sequence number from the payload: rather than moving
* the whole payload back two bytes, we shift the header forward (less bytes to move) */
buflen -= 2;
plen -= 2;
size_t hsize = payload-buf;
memmove(buf+2, buf, hsize);
buf += 2;
payload +=2;
header = (janus_rtp_header *)buf;
if (plen > 0) {
memcpy(&header->seq_number, payload, 2);
/* Finally, remove the original sequence number from the payload: rather than moving
* the whole payload back two bytes, we shift the header forward (less bytes to move) */
buflen -= 2;
plen -= 2;
size_t hsize = payload-buf;
memmove(buf+2, buf, hsize);
buf += 2;
payload +=2;
header = (janus_rtp_header *)buf;
}
}
/* Check if we need to handle transport wide cc */
if(stream->do_transport_wide_cc) {
Expand Down

0 comments on commit 281116d

Please sign in to comment.