From 50fa9ff9972e67899dfc4e7e6766c5977d4aae7a Mon Sep 17 00:00:00 2001 From: Matt Jordan Date: Mon, 5 Oct 2015 21:34:41 -0500 Subject: Fix improper usage of scheduler exposed by 5c713fdf18f When 5c713fdf18f was merged, it allowed for scheduled items to have an ID of '0' returned. While this was valid per the documentation for the API, it was apparently never returned previously. As a result, several users of the scheduler API viewed the result as being invalid, causing them to reschedule already scheduled items or otherwise fail in interesting ways. This patch corrects the users such that they view '0' as valid, and a returned ID of -1 as being invalid. Note that the failing HEP RTCP tests now pass with this patch. These tests failed due to a duplicate scheduling of the RTCP transmissions. ASTERISK-25449 #close Change-Id: I019a9aa8b6997584f66876331675981ac9e07e39 --- res/res_rtp_asterisk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'res/res_rtp_asterisk.c') diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c index 04113123e..fb6a5be1b 100644 --- a/res/res_rtp_asterisk.c +++ b/res/res_rtp_asterisk.c @@ -3311,7 +3311,7 @@ static int ast_rtp_raw_write(struct ast_rtp_instance *instance, struct ast_frame rtp->txcount++; rtp->txoctetcount += (res - hdrlen); - if (rtp->rtcp && rtp->rtcp->schedid < 1) { + if (rtp->rtcp && rtp->rtcp->schedid < 0) { ast_debug(1, "Starting RTCP transmission on RTP instance '%p'\n", instance); ao2_ref(instance, +1); rtp->rtcp->schedid = ast_sched_add(rtp->sched, ast_rtcp_calc_interval(rtp), ast_rtcp_write, instance); @@ -4522,7 +4522,7 @@ static struct ast_frame *ast_rtp_read(struct ast_rtp_instance *instance, int rtc } /* Do not schedule RR if RTCP isn't run */ - if (rtp->rtcp && !ast_sockaddr_isnull(&rtp->rtcp->them) && rtp->rtcp->schedid < 1) { + if (rtp->rtcp && !ast_sockaddr_isnull(&rtp->rtcp->them) && rtp->rtcp->schedid < 0) { /* Schedule transmission of Receiver Report */ ao2_ref(instance, +1); rtp->rtcp->schedid = ast_sched_add(rtp->sched, ast_rtcp_calc_interval(rtp), ast_rtcp_write, instance); -- cgit v1.2.3