staticFrame*frame_queue_peek_writable(FrameQueue*f){/* wait until we have space to put a new frame */SDL_LockMutex(f->mutex);while(f->size>=f->max_size&&!f->pktq->abort_request){SDL_CondWait(f->cond,f->mutex);}SDL_UnlockMutex(f->mutex);if(f->pktq->abort_request)returnNULL...
先调用frame_queue_peek_writable 函数获取一个可写节点。 staticFrame*frame_queue_peek_writable(FrameQueue*f){SDL_LockMutex(f->mutex);// 等待,直到队列有空间可写while(f->size>=f->max_size&&!f->pktq->abort_request){SDL_CondWait(f->cond,f->mutex);}SDL_UnlockMutex(f->mutex);// 如果Pa...
frame_queue_peek_writable:获取queue中一块Frame大小的可写内存static Frame *frame_queue_peek_writable(FrameQueue *f) { /* wait until we have space to put a new frame */ SDL_LockMutex(f->mutex); while (f->size >= f->max_size && !f->pktq->abort_request) { SDL_CondWait(f->cond...
frame_queue_peek_last:返回rindex指向的节点,无论是否被读取过; frame_queue_peek_writable:检查当前队列的wrindex指向的内存是否可写,如果可写则获取对应数据的指针,如果不可写的阻塞wait,否则返回对应节点的指针; frame_queue_peek_readable:逻辑和frame_queue_peek_writable类似,检查队列是否为空,空则wait;否则返...
return&f->queue[(f->rindex +f->rindex_shown + 1) %f->max_size]; } //返回要填充的frame_queue中的Frame。 staticFrame*frame_queue_peek_writable(FrameQueue*f) { /* wait until we have space to put a new frame */ SDL_LockMutex(f->mutex); ...
//返回要填充的frame_queue中的Frame。 staticFrame*frame_queue_peek_writable(FrameQueue*f) { /* wait until we have space to put a new frame */ SDL_LockMutex(f->mutex); while(f->size >=f->max_size && !f->pktq->abort_request) { ...
调用frame_queue_peek_writable取到Frame指针后,就可以对Frame内的字段自由改写,因为只有一个写进程,且无需担心读进程覆写(如上分析,读进程要读一个节点时,也会先判断underrun的情况)。 一般步骤是: Frame*vp=frame_queue_peek_writable(q);//将要存储的数据写入frame字段,比如:av_frame_move_ref(vp->frame,...