avformat/udp: properly use return value of pthread_cond_timedwait

Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
Marton Balint 2020-01-14 18:53:45 +01:00
parent f61e9f8aef
commit 67f39b32db
1 changed files with 3 additions and 2 deletions

View File

@ -978,9 +978,10 @@ static int udp_read(URLContext *h, uint8_t *buf, int size)
int64_t t = av_gettime() + 100000;
struct timespec tv = { .tv_sec = t / 1000000,
.tv_nsec = (t % 1000000) * 1000 };
if (pthread_cond_timedwait(&s->cond, &s->mutex, &tv) < 0) {
int err = pthread_cond_timedwait(&s->cond, &s->mutex, &tv);
if (err) {
pthread_mutex_unlock(&s->mutex);
return AVERROR(errno == ETIMEDOUT ? EAGAIN : errno);
return AVERROR(err == ETIMEDOUT ? EAGAIN : err);
}
nonblock = 1;
}