diff --git a/daemon/codec.c b/daemon/codec.c index cfb6eba11..0990f9c5a 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -3153,7 +3153,7 @@ static bool __buffer_delay_do_direct(struct delay_buffer *dbuf) { } static int delay_frame_cmp(const struct delay_frame *a, const struct delay_frame *b, void *ptr) { - return -1 * timeval_cmp(timeval_from_us(a->mp.tv), timeval_from_us(b->mp.tv)); + return (a->mp.tv < b->mp.tv ? 1 : 0) + (a->mp.tv > b->mp.tv ? -1 : 0); } INLINE struct codec_ssrc_handler *ssrc_handler_get(struct codec_ssrc_handler *ch) { diff --git a/daemon/ice.c b/daemon/ice.c index 67757794f..3467ed8cb 100644 --- a/daemon/ice.c +++ b/daemon/ice.c @@ -837,7 +837,7 @@ static void __do_ice_checks(struct ice_agent *ag) { /* check if we're done and should start nominating pairs */ if (AGENT_ISSET(ag, CONTROLLING) && !AGENT_ISSET(ag, NOMINATING) && ag->start_nominating) { - if (timeval_cmp(timeval_from_us(rtpe_now), timeval_from_us(ag->start_nominating)) >= 0) + if (rtpe_now >= ag->start_nominating) __nominate_pairs(ag); next_run = timeval_us(timeval_lowest(timeval_from_us(next_run), timeval_from_us(ag->start_nominating))); } @@ -874,7 +874,7 @@ static void __do_ice_checks(struct ice_agent *ag) { if (valid && valid->pair_priority > pair->pair_priority) continue; - if (timeval_cmp(timeval_from_us(pair->retransmit), timeval_from_us(rtpe_now)) <= 0) + if (pair->retransmit <= rtpe_now) g_queue_push_tail(&retransmits, pair); /* can't run check directly due to locks */ else diff --git a/daemon/timerthread.c b/daemon/timerthread.c index d9660ad49..c6cca1500 100644 --- a/daemon/timerthread.c +++ b/daemon/timerthread.c @@ -145,7 +145,7 @@ void timerthread_obj_schedule_abs_nl(struct timerthread_obj *tt_obj, int64_t tv) //ilog(LOG_DEBUG, "scheduling timer object at %llu.%06lu", (unsigned long long) tv->tv_sec, //(unsigned long) tv->tv_usec); - if (tt_obj->next_check && timeval_cmp(timeval_from_us(tt_obj->next_check), timeval_from_us(tv)) <= 0) + if (tt_obj->next_check && tt_obj->next_check <= tv) return; /* already scheduled sooner */ if (!g_tree_remove(tt->tree, tt_obj)) { if (tt->obj == tt_obj) @@ -156,7 +156,7 @@ void timerthread_obj_schedule_abs_nl(struct timerthread_obj *tt_obj, int64_t tv) tt_obj->next_check = tv; g_tree_insert(tt->tree, tt_obj, tt_obj); // need to wake the thread? - if (tt->next_wake && timeval_cmp(timeval_from_us(tv), timeval_from_us(tt->next_wake)) < 0) { + if (tt->next_wake && tv < tt->next_wake) { // make sure we can get picked first: move pre-picked object back into tree if (tt->obj && tt->obj != tt_obj) { g_tree_insert(tt->tree, tt->obj, tt->obj); @@ -194,7 +194,7 @@ nope: static int timerthread_queue_run_one(struct timerthread_queue *ttq, struct timerthread_queue_entry *ttqe, void (*run_func)(struct timerthread_queue *, void *)) { - if (ttqe->when && timeval_cmp(timeval_from_us(ttqe->when), timeval_from_us(rtpe_now)) > 0) { + if (ttqe->when && ttqe->when > rtpe_now) { if (ttqe->when - rtpe_now > 1000) // not to queue packet less than 1ms return -1; // not yet } @@ -300,7 +300,7 @@ int __ttqe_find_last_idx(const void *a, const void *b) { const struct timerthread_queue_entry *ttqe_a = a; void **data = (void **) b; const struct timerthread_queue_entry *ttqe_b = data[0]; - int ret = timeval_cmp(timeval_from_us(ttqe_b->when), timeval_from_us(ttqe_a->when)); + int ret = (ttqe_a->when < ttqe_b->when ? 1 : 0) + (ttqe_a->when > ttqe_b->when ? -1 : 0); if (ret) return ret; // same timestamp. track highest seen idx diff --git a/lib/codeclib.c b/lib/codeclib.c index 83dba03e6..98d533774 100644 --- a/lib/codeclib.c +++ b/lib/codeclib.c @@ -2932,7 +2932,7 @@ static void amr_bitrate_tracker(decoder_t *dec, unsigned int ft) { return; if (dec->avc.amr.tracker_end - && timeval_cmp(timeval_from_us(dec->avc.amr.tracker_end), timeval_from_us(rtpe_now)) >= 0) { + && dec->avc.amr.tracker_end >= rtpe_now) { // analyse the data we gathered int next_highest = -1; int lowest_used = -1;