From patchwork Sun Mar 31 01:32:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Holroyd X-Patchwork-Id: 12539 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 13383448F90 for ; Sun, 31 Mar 2019 04:33:10 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id ECFBC68A9DE; Sun, 31 Mar 2019 04:33:09 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 63CE668A99E for ; Sun, 31 Mar 2019 04:33:03 +0300 (EEST) Received: by mail-wr1-f53.google.com with SMTP id q1so7273142wrp.0 for ; Sat, 30 Mar 2019 18:33:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=m2amedia-tv.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=eVEuhC2eI5BrWePUnYSva1XQWG+KAzNNuZKfonmmzAU=; b=0V61MQFwaGQrCtsZYJ8h0WGuw4RRJfGEenSP9+G2zdJsT0kupI+IkuSrOHoYnmv6yy MwlH8suiGybbRzdXl//NHmmBpI9Mj3ARvWQghLK+RDSL0DApSD0WTkRHUUwcuT9hntHF I5lQ15Q1avx3PiBAgwHN9chgdjGANEw06LnLk9tRgfTg8LY+WkO8ZOnIuBBMP6G3IAJ9 efzMhRjPSGsShf6ivtfG9JuzB3jDn/vefXhQUFDHlXS14Tzkcref2AC+BdMx01patbQx ix0U/pvX2bByjhjWq2cf+bBBJq4gG0rMBMOP6adLsmN2NMqoHMXVZ3+OFFgRpeVlV047 XrYg== 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=eVEuhC2eI5BrWePUnYSva1XQWG+KAzNNuZKfonmmzAU=; b=fdcq27zWZVWIgyBZbZXVOHKwsQrkWEnmN9RLw5QYsIgWSwduzur+hr5YzrPB1yUR7w eywoV9T/M7CEPf05KVPPVyF98nm5u+IpQoRvrjFkkkkZAqUSjl9pHntDb2tQ2d3A6KF8 KAyGNRUUQDVTlnIb8PA+MCCrGFnX49TtQi9w0d5fvuDpQA5FszNMAFPnJnmKn8PzX8VF suz0AYCzh8EcUuDrI17qMiHmpAFzQWwxqrdmiOoeVMgUDzpQ4rG0EZvEWFfvHwGQ6rNv w3PKboraDDo1/ugp1Rtfn1th8WkFhRDd+CyX2l3ZGyIcOtvqaPSifFV0bqu0enuo/rj+ 45Iw== X-Gm-Message-State: APjAAAUdTufnCVR4x3gbxRo5lEz+Dwxv0Z/Shl/PRkiv7essXeXAuq3p G/uK3zyyITV5buFUnz6c6Fahgtm56xg= X-Google-Smtp-Source: APXvYqzY7NkN5tzmRc+eYOrq3+mU+V1/Jgle8k0sRPGh3uDebHtCR/pn4DZ6wypbKq48bAYC63Cpyg== X-Received: by 2002:adf:fd04:: with SMTP id e4mr37743428wrr.190.1553995982768; Sat, 30 Mar 2019 18:33:02 -0700 (PDT) Received: from localhost.localdomain (cpc1-finc16-2-0-cust8876.4-2.cable.virginm.net. [86.23.34.173]) by smtp.gmail.com with ESMTPSA id c2sm2703301wrr.13.2019.03.30.18.33.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 Mar 2019 18:33:02 -0700 (PDT) From: David Holroyd To: ffmpeg-devel@ffmpeg.org Date: Sun, 31 Mar 2019 02:32:34 +0100 Message-Id: <20190331013233.11381-1-david.holroyd@m2amedia.tv> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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). --- libavformat/prompeg.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libavformat/prompeg.c b/libavformat/prompeg.c index 94b556d5f1..c3bd5f1249 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) { PrompegContext *s = h->priv_data; 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); @@ -431,7 +430,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) { @@ -440,7 +438,7 @@ static int prompeg_write(URLContext *h, const uint8_t *buf, int size) { s->first = 0; } - ret = written; + ret = size; end: av_free(bitstring);