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 0B28B46D12 for ; Sun, 9 Jul 2023 13:39:48 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1362E68C663; Sun, 9 Jul 2023 16:39:38 +0300 (EEST) Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EBF5C68C54D for ; Sun, 9 Jul 2023 16:39:30 +0300 (EEST) Received: by mail-ot1-f52.google.com with SMTP id 46e09a7af769-6b71ee710edso2889775a34.2 for ; Sun, 09 Jul 2023 06:39:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688909969; x=1691501969; 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=QIVGLzgqyhyeLijTb/fDb0Vy5fOzeBTcOxYX7zqVY5E=; b=ICnX/lhinl/TaFaGYQDpXarcphqSRF8ZGLkoCy66orKMAoBhUYYZWgHHVCGr9SMG4q BrQzTExd+FjhRQ+hmanb44D9zZ4kCafORBYjYA+LLcRmd0dlXzYG6H6Cm+bhaBc0OLnZ o2/NV3AAi4867SSHQ4rQab3CJEoNq+Qm8mjagUOO6gYZWod3Z1wlJB7EMoeyY5F3xFTh KxekDT+G3Bd1Vz9PnXm9q9U7aLB6PfDqNUZxJRe00LsAEGz3nADuI1JVTWC66nPK2uuT mEgmX4GSi3u5+EXNSObsnVczRVK/Nq0/65yj40K+KGyiONAbeIsZzmRmB05ns8vdlUX9 ZhiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688909969; x=1691501969; 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=QIVGLzgqyhyeLijTb/fDb0Vy5fOzeBTcOxYX7zqVY5E=; b=ZydDzY3TqHPi3Tt9abkzbfXomE9pxOAqhhI55RyN9p6KrbHnCGcRv+OVy45OmOJAkO Qeiwz0KHl5EK+vmQTzn4b6wkqXGuFOE4ngmtz+iYMbQjQ6BDl10W3LqFRfmMUMZuzAw+ K4nL7yXXmHuWvJ57qXngmT4MdBIMCZA2Tw6tVTiX2G6o8dCgyQ40qxgpXZ4KWiD8LrE7 4uwpcp5NhYDyQf5rt4d/z53kw707zpIh77sywprpidFBAgCJBptBagV6nst50pqd0LQO woLrKjnu/gP75X9ZW8yDj+P45LBeX1SrFmEKnKGvrkjkz5wX020O5D3rK5aasWie/uUq 80Ww== X-Gm-Message-State: ABy/qLZP6594gTrcB+jon7p8Wi3654iiViMdiQxk9LlcZ+5AroOdj5xN zCY1D1Cl4NdrCvCmrAZUmEXC6keE5VE= X-Google-Smtp-Source: APBJJlE67G8fZDvHZUxu3/ymlH+taY1pCdohFAnxdkDRD2g2Pmjj1BT5coRYn+mFkZG3KX1uhM62Xw== X-Received: by 2002:a05:6830:22f6:b0:6b7:4e25:4c08 with SMTP id t22-20020a05683022f600b006b74e254c08mr9213444otc.12.1688909969348; Sun, 09 Jul 2023 06:39:29 -0700 (PDT) Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id r18-20020a9d7512000000b006b756242c98sm3404413otk.19.2023.07.09.06.39.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 06:39:29 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sun, 9 Jul 2023 10:39:16 -0300 Message-ID: <20230709133917.5403-2-jamrial@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230709133917.5403-1-jamrial@gmail.com> References: <20230709133917.5403-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 2/3] 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 a39af2d014..b3e4b066e5 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -597,6 +597,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".