1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-11-23 21:54:53 +02:00

fftools/ffmpeg_sched: rename mux_done_{lock,cond} into finish_*

Their semantics will be changed in the following commit to not be
limited to muxing.
This commit is contained in:
Anton Khirnov
2024-11-23 07:23:31 +01:00
parent 224b62489d
commit 785ffe67c8

View File

@@ -285,8 +285,8 @@ struct Scheduler {
pthread_mutex_t mux_ready_lock; pthread_mutex_t mux_ready_lock;
unsigned nb_mux_done; unsigned nb_mux_done;
pthread_mutex_t mux_done_lock; pthread_mutex_t finish_lock;
pthread_cond_t mux_done_cond; pthread_cond_t finish_cond;
SchDec *dec; SchDec *dec;
@@ -571,8 +571,8 @@ void sch_free(Scheduler **psch)
pthread_mutex_destroy(&sch->mux_ready_lock); pthread_mutex_destroy(&sch->mux_ready_lock);
pthread_mutex_destroy(&sch->mux_done_lock); pthread_mutex_destroy(&sch->finish_lock);
pthread_cond_destroy(&sch->mux_done_cond); pthread_cond_destroy(&sch->finish_cond);
av_freep(psch); av_freep(psch);
} }
@@ -602,11 +602,11 @@ Scheduler *sch_alloc(void)
if (ret) if (ret)
goto fail; goto fail;
ret = pthread_mutex_init(&sch->mux_done_lock, NULL); ret = pthread_mutex_init(&sch->finish_lock, NULL);
if (ret) if (ret)
goto fail; goto fail;
ret = pthread_cond_init(&sch->mux_done_cond, NULL); ret = pthread_cond_init(&sch->finish_cond, NULL);
if (ret) if (ret)
goto fail; goto fail;
@@ -1669,17 +1669,17 @@ int sch_wait(Scheduler *sch, uint64_t timeout_us, int64_t *transcode_ts)
// convert delay to absolute timestamp // convert delay to absolute timestamp
timeout_us += av_gettime(); timeout_us += av_gettime();
pthread_mutex_lock(&sch->mux_done_lock); pthread_mutex_lock(&sch->finish_lock);
if (sch->nb_mux_done < sch->nb_mux) { if (sch->nb_mux_done < sch->nb_mux) {
struct timespec tv = { .tv_sec = timeout_us / 1000000, struct timespec tv = { .tv_sec = timeout_us / 1000000,
.tv_nsec = (timeout_us % 1000000) * 1000 }; .tv_nsec = (timeout_us % 1000000) * 1000 };
pthread_cond_timedwait(&sch->mux_done_cond, &sch->mux_done_lock, &tv); pthread_cond_timedwait(&sch->finish_cond, &sch->finish_lock, &tv);
} }
ret = sch->nb_mux_done == sch->nb_mux; ret = sch->nb_mux_done == sch->nb_mux;
pthread_mutex_unlock(&sch->mux_done_lock); pthread_mutex_unlock(&sch->finish_lock);
*transcode_ts = atomic_load(&sch->last_dts); *transcode_ts = atomic_load(&sch->last_dts);
@@ -2152,14 +2152,14 @@ static int mux_done(Scheduler *sch, unsigned mux_idx)
pthread_mutex_unlock(&sch->schedule_lock); pthread_mutex_unlock(&sch->schedule_lock);
pthread_mutex_lock(&sch->mux_done_lock); pthread_mutex_lock(&sch->finish_lock);
av_assert0(sch->nb_mux_done < sch->nb_mux); av_assert0(sch->nb_mux_done < sch->nb_mux);
sch->nb_mux_done++; sch->nb_mux_done++;
pthread_cond_signal(&sch->mux_done_cond); pthread_cond_signal(&sch->finish_cond);
pthread_mutex_unlock(&sch->mux_done_lock); pthread_mutex_unlock(&sch->finish_lock);
return 0; return 0;
} }