Merge "res_rtp_asterisk.c: Check RTP packet version earlier." into 13

This commit is contained in:
Jenkins2
2017-09-06 09:34:55 -05:00
committed by Gerrit Code Review

View File

@@ -5070,6 +5070,11 @@ static struct ast_frame *ast_rtp_read(struct ast_rtp_instance *instance, int rtc
return &ast_null_frame;
}
/* If the version is not what we expected by this point then just drop the packet */
if (version != 2) {
return &ast_null_frame;
}
/* If strict RTP protection is enabled see if we need to learn the remote address or if we need to drop the packet */
if (rtp->strict_rtp_state == STRICT_RTP_LEARN) {
if (!ast_sockaddr_cmp(&rtp->strict_rtp_address, &addr)) {
@@ -5116,11 +5121,6 @@ static struct ast_frame *ast_rtp_read(struct ast_rtp_instance *instance, int rtc
}
}
/* If the version is not what we expected by this point then just drop the packet */
if (version != 2) {
return &ast_null_frame;
}
/* Pull out the various other fields we will need */
payloadtype = (seqno & 0x7f0000) >> 16;
padding = seqno & (1 << 29);