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.
pull/391/head
Anton Khirnov 2 months ago
parent 224b62489d
commit 785ffe67c8
  1. 24
      fftools/ffmpeg_sched.c

@ -285,8 +285,8 @@ struct Scheduler {
pthread_mutex_t mux_ready_lock;
unsigned nb_mux_done;
pthread_mutex_t mux_done_lock;
pthread_cond_t mux_done_cond;
pthread_mutex_t finish_lock;
pthread_cond_t finish_cond;
SchDec *dec;
@ -571,8 +571,8 @@ void sch_free(Scheduler **psch)
pthread_mutex_destroy(&sch->mux_ready_lock);
pthread_mutex_destroy(&sch->mux_done_lock);
pthread_cond_destroy(&sch->mux_done_cond);
pthread_mutex_destroy(&sch->finish_lock);
pthread_cond_destroy(&sch->finish_cond);
av_freep(psch);
}
@ -602,11 +602,11 @@ Scheduler *sch_alloc(void)
if (ret)
goto fail;
ret = pthread_mutex_init(&sch->mux_done_lock, NULL);
ret = pthread_mutex_init(&sch->finish_lock, NULL);
if (ret)
goto fail;
ret = pthread_cond_init(&sch->mux_done_cond, NULL);
ret = pthread_cond_init(&sch->finish_cond, NULL);
if (ret)
goto fail;
@ -1669,17 +1669,17 @@ int sch_wait(Scheduler *sch, uint64_t timeout_us, int64_t *transcode_ts)
// convert delay to absolute timestamp
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) {
struct timespec tv = { .tv_sec = timeout_us / 1000000,
.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;
pthread_mutex_unlock(&sch->mux_done_lock);
pthread_mutex_unlock(&sch->finish_lock);
*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_lock(&sch->mux_done_lock);
pthread_mutex_lock(&sch->finish_lock);
av_assert0(sch->nb_mux_done < sch->nb_mux);
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;
}

Loading…
Cancel
Save