?? hust_rtpqueueinternal.c
字號:
/*------------------------------------------------------------------------- * rtpqueueinternal.c - _rtpqclear, _rtpqinsert, rtpqueueextract *------------------------------------------------------------------------- */#include <ipOS.h>#include <ipHAL.h>#include "hust_rtp.h"#include "hust_bufpool.h"////#include <pthread.h>///#include <stdlib.h>///#include <strings.h>/*------------------------------------------------------------------------ * _rtpqclear - free all packets from a stream's RTP queue. * Assumes queue already locked. *------------------------------------------------------------------------ */int_rtpqclear(struct rtpqueue *pq){ struct rtpln *p, *q; p = pq->rq_tail; while (p != NULL) { q = p->rln_next; ///bufpoolfreebuf(p); heap_free(p); p = q; } pq->rq_tail = NULL; pq->rq_head = NULL; return OK;}/*------------------------------------------------------------------------ * _rtpqinsert - insert a node into a stream's RTP queue. * Assumes queue already locked. *------------------------------------------------------------------------ */int_rtpqinsert(struct rtpqueue *pq, struct rtpln *pln, bool *head){ struct rtpln *p, *q; if (head != NULL) *head = FALSE; p = pq->rq_tail; q = NULL; while (p != NULL && p->rln_seq > pln->rln_seq) { q = p; p = p->rln_next; } if (q != NULL) { q->rln_next = pln; pln->rln_prev = q; } else { pq->rq_tail = pln; pln->rln_prev = NULL; } if (p != NULL) { p->rln_prev = pln; pln->rln_next = p; } else { pq->rq_head = pln; pln->rln_next = NULL; if (head != NULL) *head = TRUE; } pq->rq_len += pln->rln_len; return OK;}/*------------------------------------------------------------------------ * rtpqextract - extrace a packet from the doubly-linked list * Assumes queue already locked. *------------------------------------------------------------------------ */struct rtpln *rtpqextract(struct rtpqueue *pq, struct rtpln *pln){ struct rtpln *n, *p; if (pln == NULL) return NULL; n = pln->rln_next; p = pln->rln_prev; if (n != NULL) n->rln_prev = p; else pq->rq_head = p; if (p != NULL) p->rln_next = n; else pq->rq_tail = n; pln->rln_next = NULL; pln->rln_prev = NULL; pq->rq_len -= pln->rln_len; return pln;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -