packet_queue_flush static void packet_queue_flush(PacketQueue *q) { MyAVPacketList pkt1; //加锁 SDL_LockMutex(q->mutex); //从内部队列循环获取元素,存入pkt1中 while (av_fifo_read(q->pkt_list, &pkt1, 1) >= 0) //释放MyAVPacketList中的AVPacket的内存 av_packet_free(&pkt1.pkt); ...
staticintpacket_queue_put_nullpacket(PacketQueue*q,intstream_index){AVPacketpkt1,*pkt=&pkt1;av_init_packet(pkt);pkt->data=NULL;pkt->size=0;pkt->stream_index=stream_index;returnpacket_queue_put(q,pkt);} 打完仗准备跑路了,先清理一下物资,packet_queue_flush中先看看队列里还有木有包,有就将...
一 对于packet_queue_put_private主要完成3件事: 1 计算serial。serial标记了这个节点内的数据是何时的。⼀般情况下新增节点与上⼀个节点的serial是⼀ 样的,但当队列中加⼊⼀个flush_pkt后,后续节点的serial会⽐之前⼤1,⽤来区别不同播放序列的 packet. 2 节点⼊队列操作。 3 队列属性操作。更新...
ffplay中释放AVPacket static void packet_queue_flush(PacketQueue *q) { MyAVPacketList *pkt, *pkt1; ... for (pkt = q->first_pkt; pkt; pkt = pkt1) { pkt1 = pkt->next; //减少引用计数,符合要求时删除buffer av_packet_unref(&pkt->pkt); av_freep(&pkt); } ... } 1. 2. 3. ...
static void packet_queue_flush(PacketQueue *q) { MyAVPacketList *pkt, *pkt1; ... for (pkt = q->first_pkt; pkt; pkt = pkt1) { pkt1 = pkt->next; //减少引用计数,符合要求时删除buffer av_packet_unref(&pkt->pkt); av_freep(&pkt); ...
2、packet_queue_destroy:销毁队列 销毁函数负责清理释放节点、mutex和cond: staticvoidpacket_queue_destroy(PacketQueue*q){packet_queue_flush(q);//清除队列中所有的节点SDL_LockMutex(q->mutex);while(q->recycle_pkt){MyAVPacketList*pkt=q->recycle_pkt;if(pkt)q->recycle_pkt=pkt->next;av_freep(&...
写过程中的三层buffer写过程中会以chunk、packet及packet queue三个粒度做三层缓存; 首先,当数据流入DFSOutputStream时,DFSOutputStream内会有一个chunk大小的buf,当数据写满这个buf(或遇到强制flush),会计算checksum值,然后填塞进packet; 当一个chunk填塞进入packet后,仍然不会立即发送,而是累积到一个packet填满后,将...
if (pkt != &flush_pkt && ret < 0) av_free_packet(pkt); av_packet_unref(pkt); return ret; } @@ -472,7 +472,7 @@ static void packet_queue_flush(PacketQueue *q) SDL_LockMutex(q->mutex); for (pkt = q->first_pkt; pkt; pkt = pkt1) { pkt1 = pkt->next; av_free_packe...
packet_flush_mclist(sk); // Now the socket is dead. No more input will appear. sock_orphan(sk); sock->sk = NULL; /* Purge queues */ skb_queue_purge(&sk->sk_receive_queue); sk_refcnt_debug_release(sk); sock_put(sk);
packet_queue_abort:中止 packet_queue_get:获取一个节点 packet_queue_put:存入一个节点 packet_queue_put_nullpacket:存入一个空节点 packet_queue_flush:清除队列内所有的节点 初始化用于初始各个字段的值,并创建mutex和cond: static int packet_queue_init(PacketQueue *q) { memset(q, 0, sizeof(PacketQue...