[FFmpeg-devel] [PATCH 2/3] avformat/udp: Use avutil compat pthread_cond_timedwait.

Matt Oliver protogonoi at gmail.com
Wed Dec 7 08:04:40 EET 2016


Signed-off-by: Matt Oliver <protogonoi at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-avformat-udp-Use-avutil-compat-pthread_cond_timedwai.patch
Type: application/octet-stream
Size: 1621 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161207/721bbe6b/attachment.obj>


More information about the ffmpeg-devel mailing list