MT#55283 convert timeval_cmp to int64_t

Change-Id: I99a2029f81c3a2efa626ac4b752cddc06d77fe3b
pull/1855/merge
Richard Fuchs 2 weeks ago
parent 8d050d5fc9
commit 9018099467

@ -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) { 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) { INLINE struct codec_ssrc_handler *ssrc_handler_get(struct codec_ssrc_handler *ch) {

@ -837,7 +837,7 @@ static void __do_ice_checks(struct ice_agent *ag) {
/* check if we're done and should start nominating pairs */ /* check if we're done and should start nominating pairs */
if (AGENT_ISSET(ag, CONTROLLING) && !AGENT_ISSET(ag, NOMINATING) && ag->start_nominating) { 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); __nominate_pairs(ag);
next_run = timeval_us(timeval_lowest(timeval_from_us(next_run), timeval_from_us(ag->start_nominating))); 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) if (valid && valid->pair_priority > pair->pair_priority)
continue; 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 g_queue_push_tail(&retransmits, pair); /* can't run check directly
due to locks */ due to locks */
else else

@ -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, //ilog(LOG_DEBUG, "scheduling timer object at %llu.%06lu", (unsigned long long) tv->tv_sec,
//(unsigned long) tv->tv_usec); //(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 */ return; /* already scheduled sooner */
if (!g_tree_remove(tt->tree, tt_obj)) { if (!g_tree_remove(tt->tree, tt_obj)) {
if (tt->obj == 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; tt_obj->next_check = tv;
g_tree_insert(tt->tree, tt_obj, tt_obj); g_tree_insert(tt->tree, tt_obj, tt_obj);
// need to wake the thread? // 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 // make sure we can get picked first: move pre-picked object back into tree
if (tt->obj && tt->obj != tt_obj) { if (tt->obj && tt->obj != tt_obj) {
g_tree_insert(tt->tree, 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, static int timerthread_queue_run_one(struct timerthread_queue *ttq,
struct timerthread_queue_entry *ttqe, struct timerthread_queue_entry *ttqe,
void (*run_func)(struct timerthread_queue *, void *)) { 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 if (ttqe->when - rtpe_now > 1000) // not to queue packet less than 1ms
return -1; // not yet 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; const struct timerthread_queue_entry *ttqe_a = a;
void **data = (void **) b; void **data = (void **) b;
const struct timerthread_queue_entry *ttqe_b = data[0]; 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) if (ret)
return ret; return ret;
// same timestamp. track highest seen idx // same timestamp. track highest seen idx

@ -2932,7 +2932,7 @@ static void amr_bitrate_tracker(decoder_t *dec, unsigned int ft) {
return; return;
if (dec->avc.amr.tracker_end 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 // analyse the data we gathered
int next_highest = -1; int next_highest = -1;
int lowest_used = -1; int lowest_used = -1;

Loading…
Cancel
Save