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

Function receiver_thread

tests/api/api-threadmessage-test.c:127–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127static void *receiver_thread(void *arg)
128{
129 int i, ret = 0;
130 struct receiver_data *rd = arg;
131
132 for (i = 0; i < rd->workload; i++) {
133 if (rand() % rd->workload < rd->workload / 10) {
134 av_log(NULL, AV_LOG_INFO, "receiver #%d: flushing the queue, "
135 "discarding %d message(s)\n", rd->id,
136 av_thread_message_queue_nb_elems(rd->queue));
137 av_thread_message_flush(rd->queue);
138 } else {
139 struct message msg;
140 AVDictionary *meta;
141 AVDictionaryEntry *e;
142
143 ret = av_thread_message_queue_recv(rd->queue, &msg, 0);
144 if (ret < 0)
145 break;
146 av_assert0(msg.magic == MAGIC);
147 meta = msg.frame->metadata;
148 e = av_dict_get(meta, "sig", NULL, 0);
149 av_log(NULL, AV_LOG_INFO, "got \"%s\" (%p)\n", e->value, msg.frame);
150 av_frame_free(&msg.frame);
151 }
152 }
153
154 av_log(NULL, AV_LOG_INFO, "consumed enough (%d), stop\n", i);
155 av_thread_message_queue_set_err_send(rd->queue, ret < 0 ? ret : AVERROR_EOF);
156
157 return NULL;
158}
159
160static int get_workload(int minv, int maxv)
161{

Callers

nothing calls this directly

Calls 7

av_logFunction · 0.85
av_thread_message_flushFunction · 0.85
av_dict_getFunction · 0.85
av_frame_freeFunction · 0.85

Tested by

no test coverage detected