From patchwork Fri Aug 20 04:08:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kim Hwan X-Patchwork-Id: 29628 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp892885iov; Thu, 19 Aug 2021 21:09:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTkRtmXz+1P/7bZLrvT6+qy1bx/o4CC8kPkU3CwT7jXTuhfS7al+aPqZz5oMMBJE7tLhZ4 X-Received: by 2002:a17:907:c12:: with SMTP id ga18mr11758765ejc.107.1629432557119; Thu, 19 Aug 2021 21:09:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629432557; cv=none; d=google.com; s=arc-20160816; b=bkMg7AotSKBfzffMF6bJBRooKtOJn51Ylu5dqxSy+wCDeaQJuBD+fCLqEcih96NSZX gwffyQ3hJXolRkQPCqBMxd46UnwGf5Eq9oy0QqvjJc8NS5MdQM5PPCg6rDMYnfeUFpAU dJUkS1HWa6Pp8bDfS4I/8f+p1ViumlUSW4mbE1NgNk6qpkt0/tCYTt9j+0Se/UCHqNds 2kaE2KrODqUkX27idw1gIG9FL4PoJsljDEv7XtdJ3n2LLvGG2BPcvoa7lrDMnIEw4e/S uLCcH6RCunvhT79+jEE1RZ7cLWuHrRwCfE3Atq3N5HHVnhMhtKvfATz418mh1Q5RAhR9 /gug== 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 :delivered-to; bh=xgvUUuvu4wYXsxWeZzIK2a26hUkBVUq+A5DV3t9iWt0=; b=L6B34OoBSLMCQ7JrpR8ssMlgai+bkb/NGsyhF+PbzZKopvS3nWfYXFXZa7IWYNg9Nz Cqi/NHgwdafV+I5GVvKDfOzpog6BLo5qB5TJ+wvgR+Ock39M22/+MrJ5eX61QjiqOOd0 YEfFr0uxMuMoRK2yB//tSSbZwqLycCRY0gq5jFRhsILXJUgBUVk/aP51CwGlh+M1k0KS Rum8VFwKeIGeCQl7JlTsetdnUunh5Qv3mWyqUeJfeqI44FA4O9Wkmob0o74mpvo2VbFu Bo4Jj49qQREeME90s5b5+Xce2QWAC4BS7fSK++136AUwDeyLc3kqgvLWBTvXGMYYEqcc D0+A== ARC-Authentication-Results: i=1; mx.google.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 sp=NONE dis=NONE) header.from=naver.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id dn7si5057960edb.544.2021.08.19.21.09.16; Thu, 19 Aug 2021 21:09:17 -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; 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=NONE dis=NONE) header.from=naver.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 63A4368A044; Fri, 20 Aug 2021 07:09:12 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from kimhwan.kimhwan.kr (unknown [121.172.19.146]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B57DB687F99 for ; Fri, 20 Aug 2021 07:09:04 +0300 (EEST) Received: from kimhwan.kr (localhost [127.0.0.1]) by kimhwan.kimhwan.kr (8.15.2/8.15.2/Debian-18) with ESMTP id 17K4911V2983677; Fri, 20 Aug 2021 13:09:01 +0900 Received: (from kimhwan@localhost) by kimhwan.kr (8.15.2/8.15.2/Submit) id 17K490Pg2983606; Fri, 20 Aug 2021 13:09:00 +0900 From: Kim Hwan To: ffmpeg-devel@ffmpeg.org Date: Fri, 20 Aug 2021 13:08:56 +0900 Message-Id: <20210820040857.2983507-1-akon47@naver.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] avformat/rtsp: If the rtcp port is specified in the sdp file, set rtcpport when creating the RTP stream 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: Kim Hwan Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Hg4k8nJ6IxT+ Signed-off-by: Kim Hwan --- libavformat/rtsp.c | 8 +++++++- libavformat/rtsp.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 9869e1b72e..9fa6861c2a 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -586,6 +586,10 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, av_strlcpy(rtsp_st->control_url, p, sizeof(rtsp_st->control_url)); } + } else if (av_strstart(p, "rtcp:", &p) && s->nb_streams > 0) { + get_word(buf1, sizeof(buf1), &p); + rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1]; + rtsp_st->rtcp_port = atoi(buf1); } else if (av_strstart(p, "rtpmap:", &p) && s->nb_streams > 0) { /* NOTE: rtpmap is only supported AFTER the 'm=' tag */ get_word(buf1, sizeof(buf1), &p); @@ -2422,8 +2426,10 @@ static int sdp_read_header(AVFormatContext *s) } ff_url_join(url, sizeof(url), "rtp", NULL, namebuf, rtsp_st->sdp_port, - "?localport=%d&ttl=%d&connect=%d&write_to_source=%d", + "?localport=%d&ttl=%d&%srtcpport=%d&connect=%d&write_to_source=%d", rtsp_st->sdp_port, rtsp_st->sdp_ttl, + ff_is_multicast_address((struct sockaddr *)&rtsp_st->sdp_ip) ? "" : "local", + rtsp_st->rtcp_port <= 0 ? (rtsp_st->sdp_port + 1) : rtsp_st->rtcp_port, rt->rtsp_flags & RTSP_FLAG_FILTER_SRC ? 1 : 0, rt->rtsp_flags & RTSP_FLAG_RTCP_TO_SOURCE ? 1 : 0); diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h index 4ec974ed73..001ec3c962 100644 --- a/libavformat/rtsp.h +++ b/libavformat/rtsp.h @@ -457,6 +457,7 @@ typedef struct RTSPStream { /** The following are used only in SDP, not RTSP */ //@{ int sdp_port; /**< port (from SDP content) */ + int rtcp_port; /**< rtcp port (from SDP content) */ struct sockaddr_storage sdp_ip; /**< IP address (from SDP content) */ int nb_include_source_addrs; /**< Number of source-specific multicast include source IP addresses (from SDP content) */ struct RTSPSource **include_source_addrs; /**< Source-specific multicast include source IP addresses (from SDP content) */