From patchwork Tue Jun 9 15:06:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Zhao X-Patchwork-Id: 20249 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 6A18844AB97 for ; Tue, 9 Jun 2020 18:06:23 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 550EE68B448; Tue, 9 Jun 2020 18:06:23 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9789168B436 for ; Tue, 9 Jun 2020 18:06:16 +0300 (EEST) Received: by mail-pl1-f195.google.com with SMTP id n9so8165117plk.1 for ; Tue, 09 Jun 2020 08:06:16 -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:in-reply-to:references; bh=AY2RijgyAJ+C5VVyEUmOo9OpCxlOj12mfedrwl38U+M=; b=CiT9x+yj/KZekLsSjEbmFKEkTJvZxzdFSpdrkANYutGLSMDJ33rnQ5lADTUD63GJsa vMKL0esRQq3sjXMssctL7gNf6Eq5NyneCU7CpUztsUST/DUVwqSyBa7a2QV9drqhbCT8 DV2DB89hG1MKibwxX2Jaq9q8yHZaqtIFDEaZ+gKJ+rzIxyGE8jFoImNs3GMx/pLVePoJ 5rNe/DzSiYU/VdXzsDW9/FYIeGpRUvpP6b2B+4vVFvbaI2VTAEszpGXPyzFYf+uAzavP refeVCprWx9oofQmE/7pOZ6cvqUF84wjFM3H1CYyeU1+MXWtLiZNBgKZ3ka1sI2PiIFQ l86A== 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:in-reply-to :references; bh=AY2RijgyAJ+C5VVyEUmOo9OpCxlOj12mfedrwl38U+M=; b=A5LlfDqFAlree3Lq7ym9fFnCtcXDN44ndk/0/0+FhAtwwG1iayBsROK8XAZf06uHYU Z3h09K5kJBpZHgWUFeL9gUgOCw41aic0aa1EXI+vMQRS3YGg/ECIphazPcF/I/ynmI+r mBfnPAUqNGqX4Wmew2j7isonvsqDFhMoqXxepkEYzuKFlkHqoLawvQiUny3kwCY7uXJd +gX2ye6devt3IzAmRyvnrUKm4I2WarDEXCfXt5GKXXvPbB4YPP8ePNCrne5GgNxaWEB2 clW4Fd1ZGThBtko7YLi1v3NgPs7gsZJyX2aPbddXISnmknvR/hz/Es0RbBhOrqqSd2ec pEPw== X-Gm-Message-State: AOAM531Vba2yduDSjn+vTUAsUWIqyH3P72/2bhDW9WPyNXkCqh721Y24 nW9G9gxmk38EuhtSnqTLHRhXSS74 X-Google-Smtp-Source: ABdhPJzRaPJ11nE3L2ZMV89Gvqrry0NsJ6FLRKxW3pIj03n5fYP6u5NTQpgcEr96JqM85t1G1boACw== X-Received: by 2002:a17:902:7487:: with SMTP id h7mr3770687pll.155.1591715174447; Tue, 09 Jun 2020 08:06:14 -0700 (PDT) Received: from localhost.localdomain ([49.51.162.193]) by smtp.gmail.com with ESMTPSA id l23sm8726524pgc.55.2020.06.09.08.06.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jun 2020 08:06:13 -0700 (PDT) From: Jun Zhao To: ffmpeg-devel@ffmpeg.org Date: Tue, 9 Jun 2020 23:06:01 +0800 Message-Id: <1591715161-11246-2-git-send-email-mypopydev@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1591715161-11246-1-git-send-email-mypopydev@gmail.com> References: <1591715161-11246-1-git-send-email-mypopydev@gmail.com> Subject: [FFmpeg-devel] [PATCH v2 2/2] lavf/prompeg: prompeg_write() must report data all was written 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: David Holroyd MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: David Holroyd Previously, prompeg_write() would only report to caller that bytes we written when a FEC packet was actually created. Not all RTP packets are expected to generate a FEC packet however, so this behavior was causing avio to retry writing the RTP packet, eventually forcing the FEC state machine to send a FEC packet erroneously (and so breaking out of the retry loop). This was resulting in incorrect FEC data being generated, and far too many FEC packets to be sent (~100% FEC overhead). fix #7863 Signed-off-by: David Holroyd --- libavformat/prompeg.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libavformat/prompeg.c b/libavformat/prompeg.c index 7b2e5e8..59faa82 100644 --- a/libavformat/prompeg.c +++ b/libavformat/prompeg.c @@ -387,7 +387,7 @@ static int prompeg_write(URLContext *h, const uint8_t *buf, int size) { PrompegFec *fec_tmp; uint8_t *bitstring = NULL; int col_idx, col_out_idx, row_idx; - int ret, written = 0; + int ret = 0; if (s->init && ((ret = prompeg_init(h, buf, size)) < 0)) goto end; @@ -403,7 +403,6 @@ static int prompeg_write(URLContext *h, const uint8_t *buf, int size) { if (!s->first || s->packet_idx > 0) { if ((ret = prompeg_write_fec(h, s->fec_row, PROMPEG_FEC_ROW)) < 0) goto end; - written += ret; } memcpy(s->fec_row->bitstring, bitstring, s->bitstring_size); s->fec_row->sn = AV_RB16(buf + 2); @@ -434,7 +433,6 @@ static int prompeg_write(URLContext *h, const uint8_t *buf, int size) { col_out_idx = s->packet_idx / s->d; if ((ret = prompeg_write_fec(h, s->fec_col[col_out_idx], PROMPEG_FEC_COL)) < 0) goto end; - written += ret; } if (++s->packet_idx >= s->packet_idx_max) { @@ -443,7 +441,7 @@ static int prompeg_write(URLContext *h, const uint8_t *buf, int size) { s->first = 0; } - ret = written; + ret = size; end: av_free(bitstring);