MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / tq_receive

Function tq_receive

fftools/thread_queue.c:197–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195}
196
197int tq_receive(ThreadQueue *tq, int *stream_idx, void *data)
198{
199 int ret;
200
201 *stream_idx = -1;
202
203 pthread_mutex_lock(&tq->lock);
204
205 while (1) {
206 size_t can_read = av_container_fifo_can_read(tq->fifo);
207
208 ret = receive_locked(tq, stream_idx, data);
209
210 // signal other threads if the fifo state changed
211 if (can_read != av_container_fifo_can_read(tq->fifo))
212 pthread_cond_broadcast(&tq->cond);
213
214 if (ret == AVERROR(EAGAIN)) {
215 pthread_cond_wait(&tq->cond, &tq->lock);
216 continue;
217 }
218
219 break;
220 }
221
222 pthread_mutex_unlock(&tq->lock);
223
224 return ret;
225}
226
227void tq_send_finish(ThreadQueue *tq, unsigned int stream_idx)
228{

Callers 4

sch_mux_receiveFunction · 0.85
sch_dec_receiveFunction · 0.85
sch_enc_receiveFunction · 0.85
sch_filter_receiveFunction · 0.85

Calls 6

receive_lockedFunction · 0.85
pthread_mutex_lockFunction · 0.50
pthread_cond_broadcastFunction · 0.50
pthread_cond_waitFunction · 0.50
pthread_mutex_unlockFunction · 0.50

Tested by

no test coverage detected