From patchwork Tue Nov 28 19:55:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul B Mahol X-Patchwork-Id: 6424 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp3607988jah; Tue, 28 Nov 2017 12:04:48 -0800 (PST) X-Google-Smtp-Source: AGs4zMYa2P9CKmm0bX47vcbqedmfNvzHvoOAhcFxmhd4oubOIHAg8IU9TI2/E7WmOaWbIL8gzxkS X-Received: by 10.223.196.6 with SMTP id v6mr268764wrf.236.1511899488025; Tue, 28 Nov 2017 12:04:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511899487; cv=none; d=google.com; s=arc-20160816; b=G/pQ6jik42+5HaLwESfs4odpxvraTSBvXXmrt7CtdyORSRh1mOO5fMrbymwRaurS6t 8wNYE89+mLpWo9ssemUpHqvB+l5QH8nYmGPKMcaHiWaikJQDtsX2BWA3srTGZQwz7On7 fGUuspKArkgGGsy31ktBKw8nWiXbOFKQcCO12eQE17krKWwG6BaWXGzbM/CFV+yKvk/F TOufcgs1O8F/YFS8yrE9UJzqlYnNiEJ1XsimPPrjo2KkQMDcMkLC8cHfI822Enj0zUi8 CuJVbt4KtyviArUpC3yzHIDs+9SPrOq96KpSayvqY1hKVAKneM6hpaPJU7nC3VZYvEH5 1eOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=t5ca00gGXM47+yMweEbwezEEAL7FrQWhqo0QscWHxOQ=; b=V8v6YObFStqBum/bXOy4q73JQClvtUrALJDYfBCMqwJDDEHUYa1h+DWf29IZUiqg9Q tptJXfLrYZpPOygq0eMIpuFI210Qt86py+lhDigVnILRNmOTD18hyrp1YwCvUs+NNwmn WKnBlOInziRZiUnykS75QURpAf2I0MUQdVDwwli5sWj3LwzkzqVX54pv4VR/T626UeVb MDfIa4/jNbvDqdr9D+GRXsuSFVUewNZ27EwckNh5uiO37TLnGqNGbtWxRW8urqLJmY8s ulxShGc0BeXedsk56paDDu9U34aeH8SvnfJe9AeP44Q0WDZLO+iG14vpLM91d2kH/+Lf VT+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=eoeC2TnZ; 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=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a5si198177wmi.200.2017.11.28.12.04.47; Tue, 28 Nov 2017 12:04:47 -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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=eoeC2TnZ; 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=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4130D68A1C2; Tue, 28 Nov 2017 22:04:44 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2D36B68A18E for ; Tue, 28 Nov 2017 22:04:38 +0200 (EET) Received: by mail-wm0-f67.google.com with SMTP id i11so1802276wmf.4 for ; Tue, 28 Nov 2017 12:04:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=sV9DKwWq8L10lf9DoHAGjp8kGLdC1sRrqA1sBP/JkS0=; b=eoeC2TnZ8EUvy2NxWWGNRFh68vqgoZaAtP6SmVrtp1QvHR729QZQbX7OHWCnQkipJu 1+ZP9swyWXwrNBP/b/NI1VPQ/R4+TzjHvmjvRbqhCad2uHaJR6+BasHYVfezekaNleyW NBUfWfBktp/qVTe4cJckyR80fh9OnL/gvWBfnzadHb62z8jP6DjXtYTjxqdu2ZoTRT6T v8DorJ57s1Ng3xnslYSTv8zmRoNDUX4zertlVNCzmMOKDP+o2B3hPz/MDO+svVs2GsyG QSmwWZuwtBUoXO8JpG2FWAAruHbBJmc+0gozDe3DkXk0NtGYB5TA+MXjUK92wmf9mmKm yk0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=sV9DKwWq8L10lf9DoHAGjp8kGLdC1sRrqA1sBP/JkS0=; b=IbaI2axS1Xnm8yLGH3MbYwLCnJVzzMuH73mLRw6EqPuuyWJzuBBBKpoNOcFOu4l1bW WiIvyRp+C3uGxCEaXdgiOBi887KzJqG1c6gxsKBb/6s7HQYyk03JZ+ciniG+nHBu5AW4 gpyQi6OrW9GKBxbVzVIv42npSValNTar9P97Yh0FwsdMQUjO4cPwZSwzuRgg0vB2ibdY Us9XFgEtJUxfrZnZCYoV0VqFVeTSXpe6Ea7zuUsPEy0ZTD7kNV33HdajZ+UwL2EtPA44 7y4CY5tBsfjegOXZ02MMncH07B3Tv7lZv/n4ukfvTOi/IfMXqXF95ePt2Ese4ZAkKwMB zrGg== X-Gm-Message-State: AJaThX6Xfg1KvsQAPCBikcdY33PP4WPGYnK9Eutyoc4UlFngw5xwdaRP +4zbZ8BYBOoFxOt9QWvducq1KA== X-Received: by 10.80.224.65 with SMTP id g1mr4293942edl.264.1511898986995; Tue, 28 Nov 2017 11:56:26 -0800 (PST) Received: from localhost.localdomain ([94.250.174.60]) by smtp.gmail.com with ESMTPSA id h20sm165775edh.69.2017.11.28.11.56.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Nov 2017 11:56:26 -0800 (PST) From: Paul B Mahol To: ffmpeg-devel@ffmpeg.org Date: Tue, 28 Nov 2017 20:55:43 +0100 Message-Id: <20171128195544.5283-1-onemda@gmail.com> X-Mailer: git-send-email 2.11.0 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/mlpenc: encode last frame too 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" Signed-off-by: Paul B Mahol --- libavcodec/mlpenc.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/libavcodec/mlpenc.c b/libavcodec/mlpenc.c index 7536d3b2f5..c588f5b904 100644 --- a/libavcodec/mlpenc.c +++ b/libavcodec/mlpenc.c @@ -2225,29 +2225,27 @@ static int mlp_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, int restart_frame, ret; uint8_t *data; - if ((ret = ff_alloc_packet2(avctx, avpkt, 87500 * avctx->channels, 0)) < 0) - return ret; - - if (!frame) - return 1; - /* add current frame to queue */ if (frame) { if ((ret = ff_af_queue_add(&ctx->afq, frame)) < 0) return ret; + } else { + if (ctx->last_frame == ctx->inout_buffer) { + return 0; + } } - data = frame->data[0]; + + if ((ret = ff_alloc_packet2(avctx, avpkt, 87500 * avctx->channels, 0)) < 0) + return ret; + + data = frame ? frame->data[0] : NULL; ctx->frame_index = avctx->frame_number % ctx->max_restart_interval; ctx->inout_buffer = ctx->major_inout_buffer + ctx->frame_index * ctx->one_sample_buffer_size; - if (ctx->last_frame == ctx->inout_buffer) { - return 0; - } - ctx->sample_buffer = ctx->major_scratch_buffer + ctx->frame_index * ctx->one_sample_buffer_size; @@ -2333,6 +2331,8 @@ input_and_return: number_of_samples += ctx->frame_size[(ctx->starting_frame_index + index) % ctx->max_restart_interval]; } ctx->number_of_samples = number_of_samples; + if (!ctx->number_of_samples) + break; for (index = 0; index < ctx->seq_size[seq_index]; index++) { clear_channel_params(ctx, ctx->seq_channel_params + index*(ctx->avctx->channels));