Browse Source

MT#55283 fix padding/SRTP order

The packet must be decrypted first before RTP padding can be considered,
as the padding count is part of the encrypted payload as well.

Change-Id: I6aecff636efd420401856bb8110b3d784f989179
(cherry picked from commit 9e09cf3c40)
pull/1649/head
Richard Fuchs 3 years ago
parent
commit
c56b619bee
2 changed files with 4 additions and 2 deletions
  1. +2
    -2
      daemon/media_socket.c
  2. +2
    -0
      lib/rtplib.c

+ 2
- 2
daemon/media_socket.c View File

@ -1641,8 +1641,6 @@ static void media_packet_rtp(struct packet_handler_ctx *phc)
return; return;
if (G_LIKELY(!phc->rtcp && !rtp_payload(&phc->mp.rtp, &phc->mp.payload, &phc->s))) { if (G_LIKELY(!phc->rtcp && !rtp_payload(&phc->mp.rtp, &phc->mp.payload, &phc->s))) {
rtp_padding(phc->mp.rtp, &phc->mp.payload);
if (G_LIKELY(phc->out_srtp != NULL)) if (G_LIKELY(phc->out_srtp != NULL))
__stream_ssrc(phc->in_srtp, phc->out_srtp, phc->mp.rtp->ssrc, phc); __stream_ssrc(phc->in_srtp, phc->out_srtp, phc->mp.rtp->ssrc, phc);
@ -2115,6 +2113,8 @@ static int stream_packet(struct packet_handler_ctx *phc) {
handler_ret = media_packet_decrypt(phc); handler_ret = media_packet_decrypt(phc);
rtp_padding(phc->mp.rtp, &phc->mp.payload);
// If recording pcap dumper is set, then we record the call. // If recording pcap dumper is set, then we record the call.
if (phc->mp.call->recording) if (phc->mp.call->recording)
dump_packet(&phc->mp, &phc->s); dump_packet(&phc->mp, &phc->s);


+ 2
- 0
lib/rtplib.c View File

@ -107,6 +107,8 @@ error:
int rtp_padding(struct rtp_header *header, str *payload) { int rtp_padding(struct rtp_header *header, str *payload) {
if (!header || payload->s)
return 0;
if (!(header->v_p_x_cc & 0x20)) if (!(header->v_p_x_cc & 0x20))
return 0; // no padding return 0; // no padding
if (payload->len == 0) if (payload->len == 0)


Loading…
Cancel
Save