From patchwork Sat Oct 10 23:22:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andriy Gelman X-Patchwork-Id: 22847 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 BEEBE44B249 for ; Sun, 11 Oct 2020 02:54:09 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9093968BAB6; Sun, 11 Oct 2020 02:54:09 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9EE1168B2AB for ; Sun, 11 Oct 2020 02:54:03 +0300 (EEST) Received: by mail-qk1-f195.google.com with SMTP id x20so7450764qkn.1 for ; Sat, 10 Oct 2020 16:54:03 -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=JGU3wxwwr7ODXsXXxsMcE13xLI/7vk1E3vmpTABbyHo=; b=GMLBjqB//UR1OlA5sVHZZwl3A6amn9hLac3ztTr0uIbXimSceO1Lric6hxozIQJOf2 xkfuRQ5mfcTiR0wZwhJiSK0UbpMoMnqIvSGBsGubP5c1yHfyhymWK2WR3A943Wphshh5 JKl27lOiVzn+oSTQYRzDiyIAZcuLB4s0FSiBKCg8CuvMUMJKpoof87D78oifT2E2SHZC FqzxcsS9w+K53biQF4tL9CFrF9XwCPUxihYCLpPKJ8w4df504zIvNKUeVE8LH1DBK50T sEpW5NZltu+3SNexV7zTqMuBpO92lUfq2K2cDqtz8bSnlo+Zb2Tw2+vfXHxirIvd6s4E RGIw== 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=JGU3wxwwr7ODXsXXxsMcE13xLI/7vk1E3vmpTABbyHo=; b=XynmHt3af8L69o75GzI10A5I3WbW9qF9TyEKmEx+z4LfzkYVt8MDDBvOGwtjZQVMcN VOTnha46p5hQj+/dVzatRkkUWqLtbUDFWFwCB1djp7hi7sUzHtrGKRVuAQC70A/gTqPc SswmM5DXpKg+5RuqAJA7XHLaMhAHdD0RVV1vtTvqQ+jrn+5hJyr4ISIkDrWKN96bxdjs 5OyaqBenYu0zFzhJBktkwNdPPcLGVYAfeqdLi3AwdDeZVktTHNww7PwcY8Se/irLQebo IRynbOtBKXJG2opK90ckC3LwcaCErE0bIhyVPNmMLVlBswMRXJuLxAGIQslhjYKJrC78 y8lA== X-Gm-Message-State: AOAM532e80KA2AhgufqPEzLtwAcaJPxu8UdhgWQoumfxp7tZG/0Qq00d otTp6AikuHmkLZi82OMBvoehN4oH/Po= X-Google-Smtp-Source: ABdhPJytZevQZOO1DHhe87mbqNmITu5g85yQGdOwO38WS9VoLOc/nyQBVwFnGU7iLL5pNFr/0rUbgQ== X-Received: by 2002:a37:8fc3:: with SMTP id r186mr1735946qkd.462.1602372151433; Sat, 10 Oct 2020 16:22:31 -0700 (PDT) Received: from localhost.localdomain (c-71-232-27-28.hsd1.ma.comcast.net. [71.232.27.28]) by smtp.gmail.com with ESMTPSA id f2sm9868458qta.37.2020.10.10.16.22.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Oct 2020 16:22:31 -0700 (PDT) From: Andriy Gelman X-Google-Original-From: Andriy Gelman To: ffmpeg-devel@ffmpeg.org Date: Sat, 10 Oct 2020 19:22:18 -0400 Message-Id: <20201010232218.295220-1-andriy.gelman@gmail.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/rtsp: don't overwrite session control uri 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: Andriy Gelman Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Andriy Gelman Fixes #1941 Currently the session control uri gets overwritten by the media's uri when mpegts is signalled in the media description. This happens because s->nb_streams doesn't count mpegts which is instead part of the private context in RTSPStream. Instead use rt->nb_rtsp_streams which counts all of the media streams signalled in the sdp. This solution was originally proposed by user "tpol" on trac: https://trac.ffmpeg.org/ticket/1941 Signed-off-by: Andriy Gelman --- libavformat/rtsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index e9fca034b4..4d5459ac41 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -542,7 +542,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, break; case 'a': if (av_strstart(p, "control:", &p)) { - if (s->nb_streams == 0) { + if (rt->nb_rtsp_streams == 0) { if (!strncmp(p, "rtsp://", 7)) av_strlcpy(rt->control_uri, p, sizeof(rt->control_uri));