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

Function sq_send

fftools/sync_queue.c:333–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

331}
332
333int sq_send(SyncQueue *sq, unsigned int stream_idx, SyncQueueFrame frame)
334{
335 SyncQueueStream *st;
336 int64_t ts;
337 int ret, nb_samples;
338
339 av_assert0(stream_idx < sq->nb_streams);
340 st = &sq->streams[stream_idx];
341
342 if (frame_null(sq, frame)) {
343 av_log(sq->logctx, AV_LOG_DEBUG, "sq: %u EOF\n", stream_idx);
344 finish_stream(sq, stream_idx);
345 return 0;
346 }
347 if (st->finished)
348 return AVERROR_EOF;
349
350 tb_update(sq, st, frame);
351
352 nb_samples = frame_samples(sq, frame);
353 // make sure frame duration is consistent with sample count
354 if (nb_samples) {
355 av_assert0(frame.f->sample_rate > 0);
356 frame.f->duration = av_rescale_q(nb_samples, (AVRational){ 1, frame.f->sample_rate },
357 frame.f->time_base);
358 }
359
360 ts = frame_end(sq, frame, 0);
361
362 av_log(sq->logctx, AV_LOG_DEBUG, "sq: send %u ts %s\n", stream_idx,
363 av_ts2timestr(ts, &st->tb));
364
365 ret = av_container_fifo_write(st->fifo, SQPTR(sq, frame), 0);
366 if (ret < 0)
367 return ret;
368
369 stream_update_ts(sq, stream_idx, ts);
370
371 st->samples_queued += nb_samples;
372 st->samples_sent += nb_samples;
373
374 if (st->frame_samples)
375 st->frames_sent = st->samples_sent / st->frame_samples;
376 else
377 st->frames_sent++;
378
379 if (st->frames_sent >= st->frames_max) {
380 av_log(sq->logctx, AV_LOG_DEBUG, "sq: %u frames_max %"PRIu64" reached\n",
381 stream_idx, st->frames_max);
382
383 finish_stream(sq, stream_idx);
384 }
385
386 return 0;
387}
388
389static void offset_audio(AVFrame *f, int nb_samples)
390{

Callers 2

sync_queue_processFunction · 0.85
send_to_enc_sqFunction · 0.85

Calls 9

frame_nullFunction · 0.85
av_logFunction · 0.85
finish_streamFunction · 0.85
tb_updateFunction · 0.85
frame_samplesFunction · 0.85
av_rescale_qFunction · 0.85
av_container_fifo_writeFunction · 0.85
stream_update_tsFunction · 0.85
frame_endFunction · 0.70

Tested by

no test coverage detected