From patchwork Wed Dec 7 06:04:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Oliver X-Patchwork-Id: 1706 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.65.86 with SMTP id o83csp124497vsa; Tue, 6 Dec 2016 22:04:52 -0800 (PST) X-Received: by 10.28.193.199 with SMTP id r190mr859619wmf.58.1481090691451; Tue, 06 Dec 2016 22:04:51 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id x3si23021043wjs.193.2016.12.06.22.04.50; Tue, 06 Dec 2016 22:04:51 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6994C689D3F; Wed, 7 Dec 2016 08:04:38 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io0-f193.google.com (mail-io0-f193.google.com [209.85.223.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B71C2689AEE for ; Wed, 7 Dec 2016 08:04:31 +0200 (EET) Received: by mail-io0-f193.google.com with SMTP id r94so11361880ioe.1 for ; Tue, 06 Dec 2016 22:04:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=2md7jXZY/KfJACvOMDcNUsr1wPcd53zq65BrwjHVFMI=; b=n5T+9/iUpP5wZTfOccqEdcke3hFETY4xYqaUAJwg9nfoGxqcMhu7zjmKnzaEbRrdlH IasC4EQVP6ZnuXdPy26cvJ931yhijMnrQ5tjm4MwZ5gAHPxv7A+wXCxb7DHPJ+PQ9gCi 1Tdk7U/7Ge+sbF/TEFBeav/LlhpM4XbSwrvJBPGg+XS8beVxr2HEFKm3G1B+gyClB5Ih tt3QQBTSuqF64IM2se4PtqLrIi4F2o/fy8gIBzKj8hXuMGcVNNzBKh0E/Ur0WKo7aRfR JuO6wfXOig8FD5iBa5V4YVd/HxpiMX1znO8PDNB8Rxx6c8I579Df9NoskV4on08xNeHp Z/TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=2md7jXZY/KfJACvOMDcNUsr1wPcd53zq65BrwjHVFMI=; b=EZEPDMqt/eZMIipTAI6HiejKkdW9Cun3E7qEH0qLTudgpZlnw/FIHduUiQAD+jHOJy 77UKxqsUWCV/qxFRTfN5GYwYF28EL1Qjzb1wikpaiNSRE/bQEl3eEHtIzW3dVsRNoXJN u5bdTu9PsLuuUMOiMf295SbBgp2hkzQ7nZ4RfpRPFrV498mkJY+fOAkg9/sZT+t1z61L ZsBbs0eAfb0dIzrQkU+wbo3s42bJJ8gUKwrzQsz/Oglt1fPo58WqCopHBAC4nLIEJpr1 OcJnLWhuu1bd+K7NcijWO9A6vKRYQ6O9eVOtrJ0w1y3Vctu0vSWvwC0TjHGBVs09SLAY 2ttQ== X-Gm-Message-State: AKaTC03KlrR337ZDXbX4abc3nJRVw0TpPmYhwl2LfiATfB+eRFN/D2+x739zdYfyfQPjPFzJya81ZItgbtxAJQ== X-Received: by 10.107.175.147 with SMTP id p19mr58008807ioo.80.1481090681228; Tue, 06 Dec 2016 22:04:41 -0800 (PST) MIME-Version: 1.0 Received: by 10.36.65.90 with HTTP; Tue, 6 Dec 2016 22:04:40 -0800 (PST) From: Matt Oliver Date: Wed, 7 Dec 2016 17:04:40 +1100 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: [FFmpeg-devel] [PATCH 2/3] avformat/udp: Use avutil compat pthread_cond_timedwait. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Matt Oliver --- libavformat/udp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) nonblock = 1; } 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 -#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); }