Their semantics will be changed in the following commit to not be limited to muxing.
Unified · Split
| @@ -285,8 +285,8 @@ struct Scheduler { · 284 unmodified lines | ||
| 285 | 285 | pthread_mutex_t mux_ready_lock; |
| 286 | 286 | |
| 287 | 287 | unsigned nb_mux_done; |
| 288 | − pthread_mutex_t mux_done_lock; | |
| 289 | − pthread_cond_t mux_done_cond; | |
| 288 | + pthread_mutex_t finish_lock; | |
| 289 | + pthread_cond_t finish_cond; | |
| 290 | 290 | |
| 291 | 291 | |
| 292 | 292 | SchDec *dec; |
| @@ -571,8 +571,8 @@ void sch_free(Scheduler **psch) · 278 unmodified lines | ||
| 571 | 571 | |
| 572 | 572 | pthread_mutex_destroy(&sch->mux_ready_lock); |
| 573 | 573 | |
| 574 | − pthread_mutex_destroy(&sch->mux_done_lock); | |
| 575 | − pthread_cond_destroy(&sch->mux_done_cond); | |
| 574 | + pthread_mutex_destroy(&sch->finish_lock); | |
| 575 | + pthread_cond_destroy(&sch->finish_cond); | |
| 576 | 576 | |
| 577 | 577 | av_freep(psch); |
| 578 | 578 | } |
| @@ -602,11 +602,11 @@ Scheduler *sch_alloc(void) · 23 unmodified lines | ||
| 602 | 602 | if (ret) |
| 603 | 603 | goto fail; |
| 604 | 604 | |
| 605 | − ret = pthread_mutex_init(&sch->mux_done_lock, NULL); | |
| 605 | + ret = pthread_mutex_init(&sch->finish_lock, NULL); | |
| 606 | 606 | if (ret) |
| 607 | 607 | goto fail; |
| 608 | 608 | |
| 609 | − ret = pthread_cond_init(&sch->mux_done_cond, NULL); | |
| 609 | + ret = pthread_cond_init(&sch->finish_cond, NULL); | |
| 610 | 610 | if (ret) |
| 611 | 611 | goto fail; |
| 612 | 612 | |
| @@ -1669,17 +1669,17 @@ int sch_wait(Scheduler *sch, uint64_t timeout_us, int64_t *transcode_ts) · 1056 unmodified lines | ||
| 1669 | 1669 | // convert delay to absolute timestamp |
| 1670 | 1670 | timeout_us += av_gettime(); |
| 1671 | 1671 | |
| 1672 | − pthread_mutex_lock(&sch->mux_done_lock); | |
| 1672 | + pthread_mutex_lock(&sch->finish_lock); | |
| 1673 | 1673 | |
| 1674 | 1674 | if (sch->nb_mux_done < sch->nb_mux) { |
| 1675 | 1675 | struct timespec tv = { .tv_sec = timeout_us / 1000000, |
| 1676 | 1676 | .tv_nsec = (timeout_us % 1000000) * 1000 }; |
| 1677 | − pthread_cond_timedwait(&sch->mux_done_cond, &sch->mux_done_lock, &tv); | |
| 1677 | + pthread_cond_timedwait(&sch->finish_cond, &sch->finish_lock, &tv); | |
| 1678 | 1678 | } |
| 1679 | 1679 | |
| 1680 | 1680 | ret = sch->nb_mux_done == sch->nb_mux; |
| 1681 | 1681 | |
| 1682 | − pthread_mutex_unlock(&sch->mux_done_lock); | |
| 1682 | + pthread_mutex_unlock(&sch->finish_lock); | |
| 1683 | 1683 | |
| 1684 | 1684 | *transcode_ts = atomic_load(&sch->last_dts); |
| 1685 | 1685 | |
| @@ -2152,14 +2152,14 @@ static int mux_done(Scheduler *sch, unsigned mux_idx) · 466 unmodified lines | ||
| 2152 | 2152 | |
| 2153 | 2153 | pthread_mutex_unlock(&sch->schedule_lock); |
| 2154 | 2154 | |
| 2155 | − pthread_mutex_lock(&sch->mux_done_lock); | |
| 2155 | + pthread_mutex_lock(&sch->finish_lock); | |
| 2156 | 2156 | |
| 2157 | 2157 | av_assert0(sch->nb_mux_done < sch->nb_mux); |
| 2158 | 2158 | sch->nb_mux_done++; |
| 2159 | 2159 | |
| 2160 | − pthread_cond_signal(&sch->mux_done_cond); | |
| 2160 | + pthread_cond_signal(&sch->finish_cond); | |
| 2161 | 2161 | |
| 2162 | − pthread_mutex_unlock(&sch->mux_done_lock); | |
| 2162 | + pthread_mutex_unlock(&sch->finish_lock); | |
| 2163 | 2163 | |
| 2164 | 2164 | return 0; |
| 2165 | 2165 | } |