From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id AB2A845208 for ; Wed, 12 Jul 2023 22:08:19 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 10A4068C5EC; Thu, 13 Jul 2023 01:07:50 +0300 (EEST) Received: from mail-oa1-f42.google.com (mail-oa1-f42.google.com [209.85.160.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DDDB768C5C4 for ; Thu, 13 Jul 2023 01:07:42 +0300 (EEST) Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-1b0606bee45so6607421fac.3 for ; Wed, 12 Jul 2023 15:07:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689199661; x=1691791661; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=tw9x0ryjD6Fhwo7whN2VS8paVqtWWe/aA4tIVB9CL8g=; b=IRmXjpjUOVfItS8F/AFdPxbGzc/T7cF/tbH+hrloF+kKuNaM6MPudeLjsX0e26k65m TTaWr+UjoJ3ulvEkHUY1NwSlaFXaRkH6A2LE7pyJuVGLngasvp4p9/mjT6PJZq7EpYad wGCSdcqp37v3MUKEqHGgKbhObq0HQjXF2yp0QE/5VY/XhRiB+CGyXN2FFC0mLJWjBIgq 0iPCWWyVavTShvYkBXXrF7c4YqOOQkMx+cTZJAxdep+4qMDxwjp4jmmiaX4/rumdrCbr cY7vnC6VFQW68uJb1sHCWIR0A9o19naME6Bysgbl003rDAzcLBCmBRGFfZ9XWoIl+aWc 4Spw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689199661; x=1691791661; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tw9x0ryjD6Fhwo7whN2VS8paVqtWWe/aA4tIVB9CL8g=; b=eSPRSiQsHuh9LlfCLp4UKcNko+Un1mKQdtGJJ7CtFYyNLMyeoriUm0fnOJ8NqDrsqJ m780z9+H8Hw2qr2sbq2tKdRidmQiRov5H8oAHDOLwuHFT1B7Wdd5W7cR5zFXN62HoTdv SIHoDWnF0MyHuWJWHOCqvy78RxSDsagnpFbuxUTPid8TTNmP7uuWMKZNgxBwtv+ctGeA CRoqWGWpcB8uBIXtDA1Op2RZ4ObRLcL8UHuf1XINRHJURc2TxyaxdoSCjCaTG4K5Ua+h VLRGsH+qAhWEa15qWRED/a3Y1eLTKG9Qez2AH/jtLMr6vmgxPGncGVewo2/pkOp1CCMC TnMg== X-Gm-Message-State: ABy/qLYm+yvtikUvf1BFAvBDAJx79CewQOGYT+zZS2/naFYzaveHY/m1 0v9AvmogPKmFbbbJv4D3x07FyN0XPdE= X-Google-Smtp-Source: APBJJlGntHBPCAz7zsYV+jDJFQBqDKqzhQmeZw4WkRdMoMygiiaZ0bnuH9HriKRJ1V3Lv+2TmjmxEg== X-Received: by 2002:a05:6870:c89d:b0:19f:aee0:e169 with SMTP id er29-20020a056870c89d00b0019faee0e169mr21278864oab.30.1689199661244; Wed, 12 Jul 2023 15:07:41 -0700 (PDT) Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id v13-20020a056870e28d00b001b3d5b06b6asm2433756oad.23.2023.07.12.15.07.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jul 2023 15:07:40 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Jul 2023 19:07:12 -0300 Message-ID: <20230712220712.46338-4-jamrial@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230712220712.46338-1-jamrial@gmail.com> References: <20230712220712.46338-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 4/4] avcodec/decode: check the output frame for discard samples with all decoders X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: And not just those with the old decode() API. Signed-off-by: James Almer --- libavcodec/decode.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index d1aa183b78..b8c1862ad8 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -556,6 +556,14 @@ static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame) if (codec->cb_type == FF_CODEC_CB_TYPE_RECEIVE_FRAME) { ret = codec->cb.receive_frame(avctx, frame); emms_c(); + if (!ret) { + if (avctx->codec->type == AVMEDIA_TYPE_VIDEO) + ret = (frame->flags & AV_FRAME_FLAG_DISCARD) ? AVERROR(EAGAIN) : 0; + else if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) { + int64_t discarded_samples = 0; + ret = discard_samples(avctx, frame, &discarded_samples); + } + } } else ret = decode_simple_receive_frame(avctx, frame); -- 2.41.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".