mirror of https://git.ffmpeg.org/ffmpeg.git
pthreads: Generic progress lubrication support.
Fixes bug118, bug120 and bug125 at least Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
575d494de5
commit
cf7c7f13cd
|
@ -366,6 +366,7 @@ static attribute_align_arg void *frame_worker_thread(void *arg)
|
||||||
AVCodec *codec = avctx->codec;
|
AVCodec *codec = avctx->codec;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
int i;
|
||||||
if (p->state == STATE_INPUT_READY && !fctx->die) {
|
if (p->state == STATE_INPUT_READY && !fctx->die) {
|
||||||
pthread_mutex_lock(&p->mutex);
|
pthread_mutex_lock(&p->mutex);
|
||||||
while (p->state == STATE_INPUT_READY && !fctx->die)
|
while (p->state == STATE_INPUT_READY && !fctx->die)
|
||||||
|
@ -388,6 +389,12 @@ static attribute_align_arg void *frame_worker_thread(void *arg)
|
||||||
p->state = STATE_INPUT_READY;
|
p->state = STATE_INPUT_READY;
|
||||||
|
|
||||||
pthread_mutex_lock(&p->progress_mutex);
|
pthread_mutex_lock(&p->progress_mutex);
|
||||||
|
for (i = 0; i < MAX_BUFFERS; i++)
|
||||||
|
if (p->progress_used[i]) {
|
||||||
|
p->progress[i][0] = INT_MAX;
|
||||||
|
p->progress[i][1] = INT_MAX;
|
||||||
|
}
|
||||||
|
pthread_cond_broadcast(&p->progress_cond);
|
||||||
pthread_cond_signal(&p->output_cond);
|
pthread_cond_signal(&p->output_cond);
|
||||||
pthread_mutex_unlock(&p->progress_mutex);
|
pthread_mutex_unlock(&p->progress_mutex);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue