Skip to content

Commit

Permalink
Fixed memory leak in AudioBridge in case of late packets
Browse files Browse the repository at this point in the history
  • Loading branch information
lminiero committed Jan 11, 2024
1 parent e78232e commit a15e3fd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/plugins/janus_audiobridge.c
Expand Up @@ -1130,6 +1130,7 @@ room-<unique room ID>: {
#include <ogg/ogg.h>
#endif
#include <speex/speex_jitter.h>
#define GE32(a,b) (((spx_int32_t)((a)-(b)))>=0)

#include <arpa/inet.h>
#include <net/if.h>
Expand Down Expand Up @@ -5913,7 +5914,11 @@ void janus_audiobridge_incoming_rtp(janus_plugin_session *handle, janus_plugin_r
jbp.len = 0;
jbp.timestamp = ntohl(rtp->timestamp);
jbp.span = (participant->codec == JANUS_AUDIOCODEC_OPUS ? 960 : 160);
jitter_buffer_put(participant->jitter, &jbp);
if(GE32(jbp.timestamp + jbp.span + jbp.span, jitter_buffer_get_pointer_timestamp(participant->jitter))) {
jitter_buffer_put(participant->jitter, &jbp);
} else {
janus_audiobridge_buffer_packet_destroy(pkt);
}
janus_mutex_unlock(&participant->qmutex);
}
}
Expand Down

0 comments on commit a15e3fd

Please sign in to comment.