Created
December 14, 2016 04:54
-
-
Save Sibras/4c96b62db5f382ba004c56914a09f3fe to your computer and use it in GitHub Desktop.
[PATCH 2/3] avformat/udp: Use avutil compat pthread_cond_timedwait.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 62da19c5377b1394bd919badd8fb7642294077cf Mon Sep 17 00:00:00 2001 | |
From: Matt Oliver <protogonoi@gmail.com> | |
Date: Wed, 7 Dec 2016 16:57:14 +1100 | |
Subject: [PATCH 2/3] avformat/udp: Use avutil compat pthread_cond_timedwait. | |
Signed-off-by: Matt Oliver <protogonoi@gmail.com> | |
--- | |
libavformat/udp.c | 12 ++++++------ | |
1 file changed, 6 insertions(+), 6 deletions(-) | |
diff --git a/libavformat/udp.c b/libavformat/udp.c | |
index 3835f98..f8c861d 100644 | |
--- a/libavformat/udp.c | |
+++ b/libavformat/udp.c | |
@@ -60,14 +60,14 @@ | |
#define IPPROTO_UDPLITE 136 | |
#endif | |
-#if HAVE_PTHREAD_CANCEL | |
-#include <pthread.h> | |
-#endif | |
- | |
#ifndef HAVE_PTHREAD_CANCEL | |
#define HAVE_PTHREAD_CANCEL 0 | |
#endif | |
+#if HAVE_PTHREAD_CANCEL | |
+#include "libavutil/thread.h" | |
+#endif | |
+ | |
#ifndef IPV6_ADD_MEMBERSHIP | |
#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP | |
#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP | |
@@ -1054,9 +1054,9 @@ 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) { | |
+ if (ret = pthread_cond_timedwait(&s->cond, &s->mutex, &tv) < 0) { | |
pthread_mutex_unlock(&s->mutex); | |
- return AVERROR(errno == ETIMEDOUT ? EAGAIN : errno); | |
+ return AVERROR(ret == ETIMEDOUT ? EAGAIN : ret); | |
} | |
nonblock = 1; | |
} | |
-- | |
2.10.2.windows.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment