diff options
Diffstat (limited to 'main/rtp.c')
-rw-r--r-- | main/rtp.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/main/rtp.c b/main/rtp.c index d59d29bb7..5671f8a89 100644 --- a/main/rtp.c +++ b/main/rtp.c @@ -2374,10 +2374,7 @@ struct ast_rtp *ast_rtp_get_bridged(struct ast_rtp *rtp) void ast_rtp_stop(struct ast_rtp *rtp) { - if (rtp->rtcp && rtp->rtcp->schedid > 0) { - ast_sched_del(rtp->sched, rtp->rtcp->schedid); - rtp->rtcp->schedid = -1; - } + AST_SCHED_DEL(rtp->sched, rtp->rtcp->schedid); memset(&rtp->them.sin_addr, 0, sizeof(rtp->them.sin_addr)); memset(&rtp->them.sin_port, 0, sizeof(rtp->them.sin_port)); @@ -2507,8 +2504,7 @@ void ast_rtp_destroy(struct ast_rtp *rtp) if (rtp->s > -1) close(rtp->s); if (rtp->rtcp) { - if (rtp->rtcp->schedid > 0) - ast_sched_del(rtp->sched, rtp->rtcp->schedid); + AST_SCHED_DEL(rtp->sched, rtp->rtcp->schedid); close(rtp->rtcp->s); ast_free(rtp->rtcp); rtp->rtcp=NULL; @@ -2734,9 +2730,7 @@ static int ast_rtcp_write_sr(const void *data) if (!rtp->rtcp->them.sin_addr.s_addr) { /* This'll stop rtcp for this rtp session */ ast_verbose("RTCP SR transmission error, rtcp halted\n"); - if (rtp->rtcp->schedid > 0) - ast_sched_del(rtp->sched, rtp->rtcp->schedid); - rtp->rtcp->schedid = -1; + AST_SCHED_DEL(rtp->sched, rtp->rtcp->schedid); return 0; } @@ -2793,9 +2787,7 @@ static int ast_rtcp_write_sr(const void *data) res = sendto(rtp->rtcp->s, (unsigned int *)rtcpheader, len, 0, (struct sockaddr *)&rtp->rtcp->them, sizeof(rtp->rtcp->them)); if (res < 0) { ast_log(LOG_ERROR, "RTCP SR transmission error to %s:%d, rtcp halted %s\n",ast_inet_ntoa(rtp->rtcp->them.sin_addr), ntohs(rtp->rtcp->them.sin_port), strerror(errno)); - if (rtp->rtcp->schedid > 0) - ast_sched_del(rtp->sched, rtp->rtcp->schedid); - rtp->rtcp->schedid = -1; + AST_SCHED_DEL(rtp->sched, rtp->rtcp->schedid); return 0; } @@ -2868,9 +2860,7 @@ static int ast_rtcp_write_rr(const void *data) if (!rtp->rtcp->them.sin_addr.s_addr) { ast_log(LOG_ERROR, "RTCP RR transmission error, rtcp halted\n"); - if (rtp->rtcp->schedid > 0) - ast_sched_del(rtp->sched, rtp->rtcp->schedid); - rtp->rtcp->schedid = -1; + AST_SCHED_DEL(rtp->sched, rtp->rtcp->schedid); return 0; } @@ -2917,9 +2907,7 @@ static int ast_rtcp_write_rr(const void *data) if (res < 0) { ast_log(LOG_ERROR, "RTCP RR transmission error, rtcp halted: %s\n",strerror(errno)); /* Remove the scheduler */ - if (rtp->rtcp->schedid > 0) - ast_sched_del(rtp->sched, rtp->rtcp->schedid); - rtp->rtcp->schedid = -1; + AST_SCHED_DEL(rtp->sched, rtp->rtcp->schedid); return 0; } |