History

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.

Anton Khirnov committed 1 year ago

Commit 785ffe61 parent 224b6241 file · +12 −12Browse files

Unified · Split

fftools/ffmpeg_sched.c+12−12
@@ -285,8 +285,8 @@ struct Scheduler { · 284 unmodified lines
285 pthread_mutex_t mux_ready_lock;285 pthread_mutex_t mux_ready_lock;
286 286
287 unsigned nb_mux_done;287 unsigned nb_mux_done;
288 pthread_mutex_t mux_done_lock;288 pthread_mutex_t finish_lock;
289 pthread_cond_t mux_done_cond;289 pthread_cond_t finish_cond;
290 290
291 291
292 SchDec *dec;292 SchDec *dec;
@@ -571,8 +571,8 @@ void sch_free(Scheduler **psch) · 278 unmodified lines
571 571
572 pthread_mutex_destroy(&sch->mux_ready_lock);572 pthread_mutex_destroy(&sch->mux_ready_lock);
573 573
574 pthread_mutex_destroy(&sch->mux_done_lock);574 pthread_mutex_destroy(&sch->finish_lock);
575 pthread_cond_destroy(&sch->mux_done_cond);575 pthread_cond_destroy(&sch->finish_cond);
576 576
577 av_freep(psch);577 av_freep(psch);
578}578}
@@ -602,11 +602,11 @@ Scheduler *sch_alloc(void) · 23 unmodified lines
602 if (ret)602 if (ret)
603 goto fail;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 if (ret)606 if (ret)
607 goto fail;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 if (ret)610 if (ret)
611 goto fail;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 // convert delay to absolute timestamp1669 // convert delay to absolute timestamp
1670 timeout_us += av_gettime();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 if (sch->nb_mux_done < sch->nb_mux) {1674 if (sch->nb_mux_done < sch->nb_mux) {
1675 struct timespec tv = { .tv_sec = timeout_us / 1000000,1675 struct timespec tv = { .tv_sec = timeout_us / 1000000,
1676 .tv_nsec = (timeout_us % 1000000) * 1000 };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 ret = sch->nb_mux_done == sch->nb_mux;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 *transcode_ts = atomic_load(&sch->last_dts);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 pthread_mutex_unlock(&sch->schedule_lock);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 av_assert0(sch->nb_mux_done < sch->nb_mux);2157 av_assert0(sch->nb_mux_done < sch->nb_mux);
2158 sch->nb_mux_done++;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 return 0;2164 return 0;
2165}2165}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t