From patchwork Thu Nov 24 14:55:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Lo X-Patchwork-Id: 1549 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.90.1 with SMTP id o1csp239098vsb; Thu, 24 Nov 2016 06:58:54 -0800 (PST) X-Received: by 10.28.156.10 with SMTP id f10mr2925581wme.63.1479999534715; Thu, 24 Nov 2016 06:58:54 -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 xs6si37339493wjc.244.2016.11.24.06.58.54; Thu, 24 Nov 2016 06:58:54 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F1E83689A91; Thu, 24 Nov 2016 16:58:47 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ns.kevlo.org (220-135-115-6.HINET-IP.hinet.net [220.135.115.6]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 25158689822 for ; Thu, 24 Nov 2016 16:58:39 +0200 (EET) Received: from ns.kevlo.org (localhost [127.0.0.1]) by ns.kevlo.org (8.15.2/8.15.2) with ESMTPS id uAOEtqM9087109 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 24 Nov 2016 22:55:53 +0800 (CST) (envelope-from kevlo@ns.kevlo.org) Received: (from kevlo@localhost) by ns.kevlo.org (8.15.2/8.15.2/Submit) id uAOEtp3W087108 for ffmpeg-devel@ffmpeg.org; Thu, 24 Nov 2016 22:55:51 +0800 (CST) (envelope-from kevlo) Date: Thu, 24 Nov 2016 22:55:50 +0800 From: Kevin Lo To: ffmpeg-devel@ffmpeg.org Message-ID: <20161124145550.GA87084@ns.kevlo.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Subject: [FFmpeg-devel] [PATCH] avformat/rtsp: fix getnameinfo() call on FreeBSD 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" FreeBSD's socket calls require the sockaddr struct length to agree with the address family, Linux does not. This patch fixes a failing getnameinfo() call on FreeBSD. Signed-off-by: Kevin Lo diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index c6292c5..15fe25d 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -2310,7 +2310,11 @@ static int sdp_read_header(AVFormatContext *s) AVDictionary *opts = map_to_opts(rt); err = getnameinfo((struct sockaddr*) &rtsp_st->sdp_ip, +#ifdef __FreeBSD__ + ((struct sockaddr*) &rtsp_st->sdp_ip)->sa_len, +#else sizeof(rtsp_st->sdp_ip), +#endif namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST); if (err) { av_log(s, AV_LOG_ERROR, "getnameinfo: %s\n", gai_strerror(err));