From patchwork Wed Oct 14 14:35:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 22948 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 20DF0448D83 for ; Wed, 14 Oct 2020 17:42:46 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F361368BA6D; Wed, 14 Oct 2020 17:42:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qv1-f67.google.com (mail-qv1-f67.google.com [209.85.219.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ABF0C68B8DB for ; Wed, 14 Oct 2020 17:42:39 +0300 (EEST) Received: by mail-qv1-f67.google.com with SMTP id ev17so1607709qvb.3 for ; Wed, 14 Oct 2020 07:42:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=j577ZzFO4D+bb6rIdnOXOBzpUsXZP/peukXRqso8xHI=; b=jmB7Y6lp8xcI1RX85VKKjryhyDXHBg/PopN1Pyfsjvgip546+/S6cc67Fptsdhjr2J oirQntS2AtOPGVTRq/hiDe8/2iJ8D5YG+3iUBg27mBy/xsc2jGpD3oRJgIDvyHcsVmvX 8mk5wOioZW+9MvCRhPdNCrnBozhDwW9aFbNDTRyDmOClEj1062ieH2k9EqijxLigfVE2 J2VzMdgqgjEE8vqr5dbHvKJNWI0bkPaWkbCSndD+/YYbG6zFWITsxGwpc390Nb/PkfYL ZKpI7rxZMeRm/e8nEW8JSIBO9tGFw7DBp5iUl7cmE+GH/iddce2UvM5mjEA06czMlLjM /85A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=j577ZzFO4D+bb6rIdnOXOBzpUsXZP/peukXRqso8xHI=; b=eGy9pBCWpjd5ocYH6DPRjPXZ1Yz15gBApGCXL7qzyNAytPq0Fgemf8TwDgJjxSyc1R JlS7fxeJuJ/EcGuhVg8bd/ss0wrieY/9HB832zBEloHh52lkT0S5X9ZxyBQyff2UmeVU cX9aFlGkPm/JJimIPTL7LWFYVp0otqcCtO6WJ5lw4pSESHZJcUw3mBiLgdY620xGeiaQ dCC4b33+T5HkqtVcyXoeHTAFQz0qLMf8LXqmoV2hH/557R8yHxDPqBaHEy/23PyrGwwR XIRHC/Ed9NpS1UAtcHRKJHpr3QRWv+rZle/FLDl4B1nsVTAp6bCZqBCRLRvuXlOrOvAl eypQ== X-Gm-Message-State: AOAM533iWtu/io9ASWgVbReKfLqz7JGRYyeGhLvgFbArhGAtTXHZI+/E Qj4pfc2iKOrB63oVNAbHyOiQG85PkEY= X-Google-Smtp-Source: ABdhPJwk/DwltskhNWCDIm+LmlOtOB6zmiOZXFBo2PVHPzIe0pQ+yaCCtWeZkG9Na5OnjGUT+vvEhg== X-Received: by 2002:a17:902:5999:b029:d3:f00b:8ae3 with SMTP id p25-20020a1709025999b02900d3f00b8ae3mr4637126pli.36.1602686124371; Wed, 14 Oct 2020 07:35:24 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id o4sm3612035pjj.38.2020.10.14.07.35.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Oct 2020 07:35:23 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 14 Oct 2020 22:35:01 +0800 Message-Id: <1602686103-3427-4-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1602686103-3427-1-git-send-email-lance.lmwang@gmail.com> References: <1602686103-3427-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 4/6] avformat/rtsp: reuse POLLING_TIME and remove POLL_TIMEOUT_MS 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 Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtsp.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 4ecd702..49c2d52 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -51,9 +51,7 @@ #include "rtpenc.h" #include "mpegts.h" -/* Timeout values for socket poll, in ms, - * and read_packet(), in seconds */ -#define POLL_TIMEOUT_MS 100 +/* Default timeout values for read packet in seconds */ #define READ_PACKET_TIMEOUT_S 10 #define SDP_MAX_SIZE 16384 #define RECVBUF_SIZE 10 * RTP_MAX_PACKET_LENGTH @@ -1990,7 +1988,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, int n, i, ret; struct pollfd *p = rt->p; int *fds = NULL, fdsnum, fdsidx; - int runs = rt->initial_timeout * 1000LL / POLL_TIMEOUT_MS; + int runs = rt->initial_timeout * 1000LL / POLLING_TIME; if (!p) { p = rt->p = av_malloc_array(2 * rt->nb_rtsp_streams + 1, sizeof(struct pollfd)); @@ -2028,7 +2026,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, return AVERROR_EXIT; if (wait_end && wait_end - av_gettime_relative() < 0) return AVERROR(EAGAIN); - n = poll(p, rt->max_p, POLL_TIMEOUT_MS); + n = poll(p, rt->max_p, POLLING_TIME); if (n > 0) { int j = rt->rtsp_hd ? 1 : 0; for (i = 0; i < rt->nb_rtsp_streams; i++) {