From patchwork Thu Feb 9 21:51:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stepan Salenikovich X-Patchwork-Id: 2470 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp198251vsb; Thu, 9 Feb 2017 13:51:57 -0800 (PST) X-Received: by 10.223.138.172 with SMTP id y41mr4721558wry.118.1486677117538; Thu, 09 Feb 2017 13:51:57 -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 q4si14411682wra.220.2017.02.09.13.51.56; Thu, 09 Feb 2017 13:51:57 -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 9C1F3689AC7; Thu, 9 Feb 2017 23:51:50 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F1A7F689AC7 for ; Thu, 9 Feb 2017 23:51:43 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id D8B899C1CAC for ; Thu, 9 Feb 2017 16:51:45 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id U_DY0vcs_TKz for ; Thu, 9 Feb 2017 16:51:45 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 854039C1CAB for ; Thu, 9 Feb 2017 16:51:45 -0500 (EST) X-Virus-Scanned: amavisd-new at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 2nHwz_NVeZKu for ; Thu, 9 Feb 2017 16:51:45 -0500 (EST) Received: from pc-stepan.mtl.sfl (unknown [192.168.48.81]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 6D3D49C19C0 for ; Thu, 9 Feb 2017 16:51:45 -0500 (EST) From: Stepan Salenikovich To: ffmpeg-devel@ffmpeg.org Date: Thu, 9 Feb 2017 16:51:41 -0500 Message-Id: <20170209215141.9949-1-stepan.salenikovich@savoirfairelinux.com> X-Mailer: git-send-email 2.9.3 Subject: [FFmpeg-devel] [PATCH] rtpdec: fix negative missed packet count 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Account for the RTP seq num restarting after 65535 when logging the number of missed RTP packets. Change-Id: I3510c2dfb830614e25f7b93de9b3b10aa724d00c --- libavformat/rtpdec.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c index 53cdad7..c674060 100644 --- a/libavformat/rtpdec.c +++ b/libavformat/rtpdec.c @@ -748,9 +748,15 @@ static int rtp_parse_queued_packet(RTPDemuxContext *s, AVPacket *pkt) if (s->queue_len <= 0) return -1; - if (!has_next_packet(s)) + if (!has_next_packet(s)) { + int missed = s->queue->seq - s->seq - 1; + + if (missed < 0) + missed = UINT16_MAX - missed; + av_log(s->ic, AV_LOG_WARNING, - "RTP: missed %d packets\n", s->queue->seq - s->seq - 1); + "RTP: missed %d packets\n", missed); + } /* Parse the first packet in the queue, and dequeue it */ rv = rtp_parse_packet_internal(s, pkt, s->queue->buf, s->queue->len);