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

Function sch_wait

fftools/ffmpeg_sched.c:1765–1788  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1763}
1764
1765int sch_wait(Scheduler *sch, uint64_t timeout_us, int64_t *transcode_ts)
1766{
1767 int ret;
1768
1769 // convert delay to absolute timestamp
1770 timeout_us += av_gettime();
1771
1772 pthread_mutex_lock(&sch->finish_lock);
1773
1774 if (sch->nb_mux_done < sch->nb_mux) {
1775 struct timespec tv = { .tv_sec = timeout_us / 1000000,
1776 .tv_nsec = (timeout_us % 1000000) * 1000 };
1777 pthread_cond_timedwait(&sch->finish_cond, &sch->finish_lock, &tv);
1778 }
1779
1780 // abort transcoding if any task failed
1781 ret = sch->nb_mux_done == sch->nb_mux || sch->task_failed;
1782
1783 pthread_mutex_unlock(&sch->finish_lock);
1784
1785 *transcode_ts = atomic_load(&sch->last_dts);
1786
1787 return ret;
1788}
1789
1790static int enc_open(Scheduler *sch, SchEnc *enc, const AVFrame *frame)
1791{

Callers 1

transcodeFunction · 0.85

Calls 4

av_gettimeFunction · 0.85
pthread_mutex_lockFunction · 0.50
pthread_cond_timedwaitFunction · 0.50
pthread_mutex_unlockFunction · 0.50

Tested by

no test coverage detected