From patchwork Sun Jul 4 15:40:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andriy Gelman X-Patchwork-Id: 28757 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5d:965a:0:0:0:0:0 with SMTP id d26csp3387003ios; Sun, 4 Jul 2021 08:41:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzQ66LRNV40NLT4XUf+Q4qOA7HShuv82HkDHSZHCnmrkleKWSt+pvO9/pXE7obhBJBcZL/ X-Received: by 2002:a17:907:d88:: with SMTP id go8mr9188412ejc.485.1625413268123; Sun, 04 Jul 2021 08:41:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625413268; cv=none; d=google.com; s=arc-20160816; b=uat+GZZJ718lpqxy7szsZ+FOLYqQq1fjx+dS7o1EDjdEmDi7F/Vr3TSeehlYWYHO3N VNVCXGT3ERTOYoXj74vOUHVuyHmJ1/WCe5iIKljddAkmCajHq6nK30EHMrGVmU/tK7Jk jG7WW5iHtu5eWnbLuM+CpiWUgqvC0999hLpgFHwKUGocGdWfYPoXPNc6g7TTHuMzYjpI wsO+tWYgazVcujFkt1fJq9jh2+TkZhQVF5xgIOwJqQA9jKTywPmDYeFYZ27vsxdFHWuW n2z/O+HdNk2MNRQv+8K8ZrN7JqyeuOHV5wVnCZk06aS1Q9V6GdbJpfRBMiShnz3GJM4B oYRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=Ad11XMeQWa9WSNR9u+lybgNN+09KPgLGSX+/RJE2gYk=; b=WHUMBNdKwHAEcaTcQu9Hiyi098qZtS3WwMBC597e+a/p2zAU94xaawlt7dUGuBnbXf FcdRLF7bVrIRvB9QrErBjZJ0PYwB7nRShGe4eF0JmGA7xXmUlTCHzLlpyWNfJQpSV6pI njW4LBR0bY8zH3MxtKNxGAc89bAe3Xw3uNZCXj671c0ERgEAlOqTLixlfu/Fz+7JTrBs MbuRvo71fht1CHvjIQtn5HhGyuiozpzyyLtwrJz5bjNrsjXd2tCDdfuIOrKkH7b8IuKP V1zfC9FXYhfOmZMoFakeDHa7UtG0cbjKOlfl8B5SZfQvuo4YhZdLRuEad+3LTwWfnuoz GNNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=Xt7UBKaz; 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 sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id v16si9901134edd.315.2021.07.04.08.41.07; Sun, 04 Jul 2021 08:41:08 -0700 (PDT) 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 header.s=20161025 header.b=Xt7UBKaz; 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 sp=QUARANTINE 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 4F3F768A5B8; Sun, 4 Jul 2021 18:41:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt1-f176.google.com (unknown [209.85.160.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8A49C68A309 for ; Sun, 4 Jul 2021 18:40:57 +0300 (EEST) Received: by mail-qt1-f176.google.com with SMTP id f20so10512972qtk.10 for ; Sun, 04 Jul 2021 08:40:57 -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:mime-version :content-transfer-encoding; bh=6Zy07NTcyEbti+FNGVlUYsaH7nHDzEj1wzva0rNxMX4=; b=Xt7UBKazZEAEh02XAH/qnROlEpy1VYkRHczlmKdjNqeyUBfnFA9lT0cMaUa6iZp3S+ ks0P02uLkeVeFxFftTCqlrHvvWMqUqzFjkSNzX8345cuhrkN7ltPPO3yD/rIs0nrEhwE X0XLQ/hxRDfiXi7+1r33JmE5ChTp/l6y6+gSj9dFOK93drhyUePALfHxykCyXYDTdDcd CqCa2MySNbrCAA+BAf6IpvGG9e2f/sw24D6FwL2YIL2z7bA8la+tlFzJsuMDgc7I3dNj yKO8L09Rf82iFJrJXKOTKH7bg49tH/mjZarMhzCKwfCxLvwdqH224SdRkmr68BTGPJWK iJPQ== 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:mime-version :content-transfer-encoding; bh=6Zy07NTcyEbti+FNGVlUYsaH7nHDzEj1wzva0rNxMX4=; b=Ltz2Aqc/GCbYcfj0m8/jToBKmIxkflnIyvVMfXQZtPD1/m+YjMUhq+Udm/guByRxXw 1K8dPsXIsOAY/0iGe1de/e8C5nNppTFpiZHUdf/RNMhlSsXfq56whWWcAAZa9CQhYyqk WOBUtM1dvqqjPaZKjbuMaGSxNF7ZOAg320rPHTKXgZrpZMFkl66q6oFlyZfR96SCHvkp YyN73rIRaefXkxrHVClnVnNpGQ0oFz58GNEfuvFgr+qmGsewXBv1PHAtWviaeRi9qXbK +W6wwnfS1+ozQWc+pOaZfl6DhctruFoW1bnNKelvSoDE+wx6lo8YUv9RQjMcIgUpJ84n /M2Q== X-Gm-Message-State: AOAM532OU/o9EK5MK45ezDFjxXBOyMc45ZVFWR51abuQR6QmQNQVS4s2 uAwyCKluKfFPvG3KIvD6X27Dq7QsMtA= X-Received: by 2002:ac8:7d04:: with SMTP id g4mr9043187qtb.332.1625413246104; Sun, 04 Jul 2021 08:40:46 -0700 (PDT) Received: from localhost.localdomain (c-73-149-98-40.hsd1.ma.comcast.net. [73.149.98.40]) by smtp.gmail.com with ESMTPSA id s13sm4215304qkm.87.2021.07.04.08.40.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jul 2021 08:40:45 -0700 (PDT) From: Andriy Gelman X-Google-Original-From: Andriy Gelman To: ffmpeg-devel@ffmpeg.org Date: Sun, 4 Jul 2021 11:40:25 -0400 Message-Id: <20210704154027.13380-1-andriy.gelman@gmail.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 1/3] avformat/rtsp: Set port_off to zero for low min/max port range X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Andriy Gelman Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: B4NfHLkfwYas From: Andriy Gelman Fixes: $ ffmpeg -min_port 32000 -max_port 32001 -i rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov -f null - [1] 303871 floating point exception (core dumped) Signed-off-by: Andriy Gelman --- libavformat/rtsp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 9f509a229f..0185baca8e 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1438,7 +1438,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, int lower_transport, const char *real_challenge) { RTSPState *rt = s->priv_data; - int rtx = 0, j, i, err, interleave = 0, port_off; + int rtx = 0, j, i, err, interleave = 0, port_off = 0; RTSPStream *rtsp_st; RTSPMessageHeader reply1, *reply = &reply1; char cmd[MAX_URL_SIZE]; @@ -1457,9 +1457,11 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, /* Choose a random starting offset within the first half of the * port range, to allow for a number of ports to try even if the offset * happens to be at the end of the random range. */ + if (rt->rtp_port_max - rt->rtp_port_min >= 4) { port_off = av_get_random_seed() % ((rt->rtp_port_max - rt->rtp_port_min)/2); /* even random offset */ port_off -= port_off & 0x01; + } for (j = rt->rtp_port_min + port_off, i = 0; i < rt->nb_rtsp_streams; ++i) { char transport[MAX_URL_SIZE];