Lines Matching refs:timer
46 rtp_timer_set_next (RtpTimer * timer, RtpTimer * next) in rtp_timer_set_next() argument
48 GList *list = (GList *) timer; in rtp_timer_set_next()
53 rtp_timer_set_prev (RtpTimer * timer, RtpTimer * prev) in rtp_timer_set_prev() argument
55 GList *list = (GList *) timer; in rtp_timer_set_prev()
60 rtp_timer_is_later (RtpTimer * timer, RtpTimer * next) in rtp_timer_is_later() argument
66 if (!GST_CLOCK_TIME_IS_VALID (timer->timeout)) in rtp_timer_is_later()
69 if (timer->timeout > next->timeout) in rtp_timer_is_later()
73 if (timer->timeout == next->timeout && in rtp_timer_is_later()
74 gst_rtp_buffer_compare_seqnum (timer->seqnum, next->seqnum) < 0) in rtp_timer_is_later()
81 rtp_timer_is_sooner (RtpTimer * timer, RtpTimer * prev) in rtp_timer_is_sooner() argument
87 if (!GST_CLOCK_TIME_IS_VALID (timer->timeout)) in rtp_timer_is_sooner()
90 if (timer->timeout < prev->timeout) in rtp_timer_is_sooner()
94 if (timer->timeout == prev->timeout && in rtp_timer_is_sooner()
95 gst_rtp_buffer_compare_seqnum (timer->seqnum, prev->seqnum) > 0) in rtp_timer_is_sooner()
102 rtp_timer_is_closer_to_head (RtpTimer * timer, RtpTimer * head) in rtp_timer_is_closer_to_head() argument
104 RtpTimer *prev = rtp_timer_get_prev (timer); in rtp_timer_is_closer_to_head()
111 if (rtp_timer_is_sooner (timer, head)) in rtp_timer_is_closer_to_head()
114 if (rtp_timer_is_later (timer, prev)) in rtp_timer_is_closer_to_head()
120 prev_gap = gst_rtp_buffer_compare_seqnum (timer->seqnum, prev->seqnum); in rtp_timer_is_closer_to_head()
121 head_gap = gst_rtp_buffer_compare_seqnum (head->seqnum, timer->seqnum); in rtp_timer_is_closer_to_head()
127 if (GST_CLOCK_TIME_IS_VALID (timer->timeout) && in rtp_timer_is_closer_to_head()
129 prev_delta = GST_CLOCK_DIFF (timer->timeout, prev->timeout); in rtp_timer_is_closer_to_head()
130 head_delta = GST_CLOCK_DIFF (head->timeout, timer->timeout); in rtp_timer_is_closer_to_head()
140 rtp_timer_is_closer_to_tail (RtpTimer * timer, RtpTimer * tail) in rtp_timer_is_closer_to_tail() argument
142 RtpTimer *next = rtp_timer_get_next (timer); in rtp_timer_is_closer_to_tail()
149 if (rtp_timer_is_later (timer, tail)) in rtp_timer_is_closer_to_tail()
152 if (rtp_timer_is_sooner (timer, next)) in rtp_timer_is_closer_to_tail()
158 tail_gap = gst_rtp_buffer_compare_seqnum (timer->seqnum, tail->seqnum); in rtp_timer_is_closer_to_tail()
159 next_gap = gst_rtp_buffer_compare_seqnum (next->seqnum, timer->seqnum); in rtp_timer_is_closer_to_tail()
165 if (GST_CLOCK_TIME_IS_VALID (timer->timeout) && in rtp_timer_is_closer_to_tail()
167 tail_delta = GST_CLOCK_DIFF (timer->timeout, tail->timeout); in rtp_timer_is_closer_to_tail()
168 next_delta = GST_CLOCK_DIFF (next->timeout, timer->timeout); in rtp_timer_is_closer_to_tail()
184 rtp_timer_queue_set_tail (RtpTimerQueue * queue, RtpTimer * timer) in rtp_timer_queue_set_tail() argument
186 queue->timers.tail = (GList *) timer; in rtp_timer_queue_set_tail()
197 rtp_timer_queue_set_head (RtpTimerQueue * queue, RtpTimer * timer) in rtp_timer_queue_set_head() argument
199 queue->timers.head = (GList *) timer; in rtp_timer_queue_set_head()
205 RtpTimer * timer) in rtp_timer_queue_insert_before() argument
208 rtp_timer_queue_set_head (queue, timer); in rtp_timer_queue_insert_before()
210 rtp_timer_set_prev (timer, rtp_timer_get_prev (sibling)); in rtp_timer_queue_insert_before()
211 rtp_timer_set_next (rtp_timer_get_prev (sibling), timer); in rtp_timer_queue_insert_before()
214 rtp_timer_set_next (timer, sibling); in rtp_timer_queue_insert_before()
215 rtp_timer_set_prev (sibling, timer); in rtp_timer_queue_insert_before()
222 RtpTimer * timer) in rtp_timer_queue_insert_after() argument
225 rtp_timer_queue_set_tail (queue, timer); in rtp_timer_queue_insert_after()
227 rtp_timer_set_next (timer, rtp_timer_get_next (sibling)); in rtp_timer_queue_insert_after()
228 rtp_timer_set_prev (rtp_timer_get_next (sibling), timer); in rtp_timer_queue_insert_after()
231 rtp_timer_set_prev (timer, sibling); in rtp_timer_queue_insert_after()
232 rtp_timer_set_next (sibling, timer); in rtp_timer_queue_insert_after()
238 rtp_timer_queue_insert_tail (RtpTimerQueue * queue, RtpTimer * timer) in rtp_timer_queue_insert_tail() argument
246 if (timer->timeout > it->timeout) in rtp_timer_queue_insert_tail()
249 if (timer->timeout == it->timeout && in rtp_timer_queue_insert_tail()
250 gst_rtp_buffer_compare_seqnum (timer->seqnum, it->seqnum) < 0) in rtp_timer_queue_insert_tail()
258 g_queue_push_head_link (&queue->timers, (GList *) timer); in rtp_timer_queue_insert_tail()
260 rtp_timer_queue_insert_after (queue, it, timer); in rtp_timer_queue_insert_tail()
264 rtp_timer_queue_insert_head (RtpTimerQueue * queue, RtpTimer * timer) in rtp_timer_queue_insert_head() argument
270 if (!GST_CLOCK_TIME_IS_VALID (timer->timeout)) in rtp_timer_queue_insert_head()
273 if (timer->timeout < it->timeout) in rtp_timer_queue_insert_head()
277 if (timer->timeout == it->timeout && in rtp_timer_queue_insert_head()
278 gst_rtp_buffer_compare_seqnum (timer->seqnum, it->seqnum) > 0) in rtp_timer_queue_insert_head()
286 g_queue_push_tail_link (&queue->timers, (GList *) timer); in rtp_timer_queue_insert_head()
288 rtp_timer_queue_insert_before (queue, it, timer); in rtp_timer_queue_insert_head()
301 RtpTimer *timer; in rtp_timer_queue_finalize() local
303 while ((timer = rtp_timer_queue_pop_until (queue, GST_CLOCK_TIME_NONE))) in rtp_timer_queue_finalize()
304 rtp_timer_free (timer); in rtp_timer_queue_finalize()
323 rtp_timer_free (RtpTimer * timer) in rtp_timer_free() argument
325 g_return_if_fail (timer); in rtp_timer_free()
326 g_return_if_fail (timer->queued == FALSE); in rtp_timer_free()
327 g_return_if_fail (timer->list.next == NULL); in rtp_timer_free()
328 g_return_if_fail (timer->list.prev == NULL); in rtp_timer_free()
330 g_slice_free (RtpTimer, timer); in rtp_timer_free()
342 rtp_timer_dup (const RtpTimer * timer) in rtp_timer_dup() argument
345 memcpy (copy, timer, sizeof (RtpTimer)); in rtp_timer_dup()
404 rtp_timer_queue_insert (RtpTimerQueue * queue, RtpTimer * timer) in rtp_timer_queue_insert() argument
406 g_return_val_if_fail (timer->queued == FALSE, FALSE); in rtp_timer_queue_insert()
408 if (rtp_timer_queue_find (queue, timer->seqnum)) { in rtp_timer_queue_insert()
409 rtp_timer_free (timer); in rtp_timer_queue_insert()
414 if (timer->timeout == -1) in rtp_timer_queue_insert()
415 rtp_timer_queue_insert_head (queue, timer); in rtp_timer_queue_insert()
417 rtp_timer_queue_insert_tail (queue, timer); in rtp_timer_queue_insert()
420 GINT_TO_POINTER (timer->seqnum), timer); in rtp_timer_queue_insert()
421 timer->queued = TRUE; in rtp_timer_queue_insert()
438 rtp_timer_queue_reschedule (RtpTimerQueue * queue, RtpTimer * timer) in rtp_timer_queue_reschedule() argument
440 RtpTimer *it = timer; in rtp_timer_queue_reschedule()
442 g_return_val_if_fail (timer->queued == TRUE, FALSE); in rtp_timer_queue_reschedule()
444 if (rtp_timer_is_closer_to_head (timer, rtp_timer_queue_get_head (queue))) { in rtp_timer_queue_reschedule()
445 g_queue_unlink (&queue->timers, (GList *) timer); in rtp_timer_queue_reschedule()
446 rtp_timer_queue_insert_head (queue, timer); in rtp_timer_queue_reschedule()
450 while (rtp_timer_is_sooner (timer, rtp_timer_get_prev (it))) in rtp_timer_queue_reschedule()
453 if (it != timer) { in rtp_timer_queue_reschedule()
454 g_queue_unlink (&queue->timers, (GList *) timer); in rtp_timer_queue_reschedule()
455 rtp_timer_queue_insert_before (queue, it, timer); in rtp_timer_queue_reschedule()
459 if (rtp_timer_is_closer_to_tail (timer, rtp_timer_queue_get_tail (queue))) { in rtp_timer_queue_reschedule()
460 g_queue_unlink (&queue->timers, (GList *) timer); in rtp_timer_queue_reschedule()
461 rtp_timer_queue_insert_tail (queue, timer); in rtp_timer_queue_reschedule()
465 while (rtp_timer_is_later (timer, rtp_timer_get_next (it))) in rtp_timer_queue_reschedule()
468 if (it != timer) { in rtp_timer_queue_reschedule()
469 g_queue_unlink (&queue->timers, (GList *) timer); in rtp_timer_queue_reschedule()
470 rtp_timer_queue_insert_after (queue, it, timer); in rtp_timer_queue_reschedule()
486 rtp_timer_queue_unschedule (RtpTimerQueue * queue, RtpTimer * timer) in rtp_timer_queue_unschedule() argument
488 g_return_if_fail (timer->queued == TRUE); in rtp_timer_queue_unschedule()
490 g_queue_unlink (&queue->timers, (GList *) timer); in rtp_timer_queue_unschedule()
491 g_hash_table_remove (queue->hashtable, GINT_TO_POINTER (timer->seqnum)); in rtp_timer_queue_unschedule()
492 timer->queued = FALSE; in rtp_timer_queue_unschedule()
509 RtpTimer *timer; in rtp_timer_queue_pop_until() local
511 timer = (RtpTimer *) g_queue_peek_head_link (&queue->timers); in rtp_timer_queue_pop_until()
512 if (!timer) in rtp_timer_queue_pop_until()
515 if (!GST_CLOCK_TIME_IS_VALID (timer->timeout) || timer->timeout <= timeout) { in rtp_timer_queue_pop_until()
516 rtp_timer_queue_unschedule (queue, timer); in rtp_timer_queue_pop_until()
517 return timer; in rtp_timer_queue_pop_until()
534 RtpTimer *timer; in rtp_timer_queue_remove_until() local
536 while ((timer = rtp_timer_queue_pop_until (queue, timeout))) { in rtp_timer_queue_remove_until()
538 GST_TIME_FORMAT, timer->seqnum, GST_TIME_ARGS (timer->timeout), in rtp_timer_queue_remove_until()
540 rtp_timer_free (timer); in rtp_timer_queue_remove_until()
575 RtpTimer *timer; in rtp_timer_queue_set_timer() local
577 timer = rtp_timer_queue_find (queue, seqnum); in rtp_timer_queue_set_timer()
578 if (!timer) in rtp_timer_queue_set_timer()
579 timer = rtp_timer_new (); in rtp_timer_queue_set_timer()
582 if (!timer->queued || timer->seqnum != seqnum) { in rtp_timer_queue_set_timer()
584 timer->rtx_base = timeout; in rtp_timer_queue_set_timer()
587 timer->rtx_last = GST_CLOCK_TIME_NONE; in rtp_timer_queue_set_timer()
588 timer->num_rtx_retry = 0; in rtp_timer_queue_set_timer()
589 timer->num_rtx_received = 0; in rtp_timer_queue_set_timer()
592 timer->type = type; in rtp_timer_queue_set_timer()
593 timer->seqnum = seqnum; in rtp_timer_queue_set_timer()
596 timer->timeout = -1; in rtp_timer_queue_set_timer()
598 timer->timeout = timeout + delay + offset; in rtp_timer_queue_set_timer()
600 timer->offset = offset; in rtp_timer_queue_set_timer()
601 timer->duration = duration; in rtp_timer_queue_set_timer()
603 if (timer->queued) in rtp_timer_queue_set_timer()
604 rtp_timer_queue_reschedule (queue, timer); in rtp_timer_queue_set_timer()
606 rtp_timer_queue_insert (queue, timer); in rtp_timer_queue_set_timer()
696 rtp_timer_queue_update_timer (RtpTimerQueue * queue, RtpTimer * timer, in rtp_timer_queue_update_timer() argument
700 g_return_if_fail (timer != NULL); in rtp_timer_queue_update_timer()
704 GST_TIME_ARGS (timer->rtx_base), GST_TIME_ARGS (timeout)); in rtp_timer_queue_update_timer()
705 timer->rtx_base = timeout; in rtp_timer_queue_update_timer()
708 if (timer->seqnum != seqnum) { in rtp_timer_queue_update_timer()
709 timer->num_rtx_retry = 0; in rtp_timer_queue_update_timer()
710 timer->num_rtx_received = 0; in rtp_timer_queue_update_timer()
712 if (timer->queued) { in rtp_timer_queue_update_timer()
713 g_hash_table_remove (queue->hashtable, GINT_TO_POINTER (timer->seqnum)); in rtp_timer_queue_update_timer()
714 g_hash_table_insert (queue->hashtable, GINT_TO_POINTER (seqnum), timer); in rtp_timer_queue_update_timer()
719 timer->timeout = -1; in rtp_timer_queue_update_timer()
721 timer->timeout = timeout + delay + offset; in rtp_timer_queue_update_timer()
723 timer->seqnum = seqnum; in rtp_timer_queue_update_timer()
724 timer->offset = offset; in rtp_timer_queue_update_timer()
726 if (timer->queued) in rtp_timer_queue_update_timer()
727 rtp_timer_queue_reschedule (queue, timer); in rtp_timer_queue_update_timer()
729 rtp_timer_queue_insert (queue, timer); in rtp_timer_queue_update_timer()