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

Function tq_send

fftools/thread_queue.c:117–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117int tq_send(ThreadQueue *tq, unsigned int stream_idx, void *data)
118{
119 int *finished;
120 int ret;
121
122 av_assert0(stream_idx < tq->nb_streams);
123 finished = &tq->finished[stream_idx];
124
125 pthread_mutex_lock(&tq->lock);
126
127 if (*finished & FINISHED_SEND) {
128 ret = AVERROR(EINVAL);
129 goto finish;
130 }
131
132 while (!(*finished & FINISHED_RECV) && !av_fifo_can_write(tq->fifo_stream_index))
133 pthread_cond_wait(&tq->cond, &tq->lock);
134
135 if (*finished & FINISHED_RECV) {
136 ret = AVERROR_EOF;
137 *finished |= FINISHED_SEND;
138 } else {
139 ret = av_fifo_write(tq->fifo_stream_index, &stream_idx, 1);
140 if (ret < 0)
141 goto finish;
142
143 ret = av_container_fifo_write(tq->fifo, data, 0);
144 if (ret < 0)
145 goto finish;
146
147 pthread_cond_broadcast(&tq->cond);
148 }
149
150finish:
151 pthread_mutex_unlock(&tq->lock);
152
153 return ret;
154}
155
156static int receive_locked(ThreadQueue *tq, int *stream_idx,
157 void *data)

Callers 8

mux_task_startFunction · 0.85
send_to_enc_threadFunction · 0.85
send_to_muxFunction · 0.85
demux_stream_send_to_dstFunction · 0.85
demux_flushFunction · 0.85
sch_mux_sub_heartbeatFunction · 0.85
send_to_filterFunction · 0.85
enc_send_to_dstFunction · 0.85

Calls 7

av_fifo_can_writeFunction · 0.85
av_fifo_writeFunction · 0.85
av_container_fifo_writeFunction · 0.85
pthread_mutex_lockFunction · 0.50
pthread_cond_waitFunction · 0.50
pthread_cond_broadcastFunction · 0.50
pthread_mutex_unlockFunction · 0.50

Tested by

no test coverage detected