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 EA1344098B for ; Thu, 3 Feb 2022 01:02:37 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7C1BF68AE7F; Thu, 3 Feb 2022 03:02:34 +0200 (EET) Received: from eu-smtp-delivery-104.mimecast.com (eu-smtp-delivery-104.mimecast.com [185.58.85.104]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CF76B68AC71 for ; Thu, 3 Feb 2022 03:02:28 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=radio-canada.ca; s=mimecast20211019; t=1643850147; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3BR69C6CgDHXKIVKn4mS1Izyfyyk4XpbjshKo4jb97U=; b=ANpYOQUDD33DgZVSoBOAEHVRzBig3lc/qydfyfU1y+u24mQgHovbLxb2ZH9CUF8zfLXkbL ZvSC/b7JzHljBHcfQsfAqYbo61EzB4HcPT4eva1sU9b2cYAh2l9rPyZgDhHrPcdNLY4J7z HU+uow8/YMybCabgwWPkoF4MFqFgTe0= Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id uk-mta-20-Z75wclrsP7O5nqHekK67fg-1; Thu, 03 Feb 2022 01:02:26 +0000 X-MC-Unique: Z75wclrsP7O5nqHekK67fg-1 Received: by mail-io1-f70.google.com with SMTP id y4-20020a056602200400b006101b618529so706894iod.19 for ; Wed, 02 Feb 2022 17:02:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TxYkFcx+HP62hawpxMHjtTiLKOHwfWy0wwycYsmjgfY=; b=4k/g2KfNdjDmCxJRLJjIHiDTWd6hpkemjoUH7Oth8quNvp3y4UJXWZofCimVziFvoE taSaYAs0HhZ68e121WpKKszpM8oc6R2+X3nqcT2bPaR3N/zm+zVXmi0YnTxtJFTWj4PG BLnwDr95MDYZBqOlJMk05tuE8h3lgAUCRIKwDnyKNVd8qK08Kew5091i1RclKi8Hyz7W P9Rflamv0rsKXYhAe2R/wteippdGdByLgozwiobBF8ULKwoForfXuU/7FQeO3xk8m2FJ JqXsIra2f8VSNFtyBMopMTcqdWO7S8wVqWN8AAXp04sX0P7X/Cmxumc7jrfp1FTf8x7y 0FZA== X-Gm-Message-State: AOAM532+TUcJsmzh/G1LIpdqYpSyn8tWC0BNUk8Fz3Zza9IROGUYlHmc HnoO34BDCIhHuuEzDlyU1fR8aOynmz8m82YWreqLV7kkSnrgAySfvUBEPqm6UrBvJAZD59HQhxz ncAQuCrK3m4v2ru0= X-Received: by 2002:a02:3b67:: with SMTP id i39mr16145203jaf.50.1643850144842; Wed, 02 Feb 2022 17:02:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJxH5M8F4OPNbJ+qTrhPibCf9XCLCnRoIP8MVbMa5JqrODxBIGcQ1cvcUDVsXRl5FAUwW3BDMQ== X-Received: by 2002:a02:3b67:: with SMTP id i39mr16145192jaf.50.1643850144487; Wed, 02 Feb 2022 17:02:24 -0800 (PST) Received: from localhost.localdomain ([159.33.64.194]) by smtp.gmail.com with ESMTPSA id q12sm6269420ilt.15.2022.02.02.17.02.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Feb 2022 17:02:23 -0800 (PST) From: Patrick Keroulas To: ffmpeg-devel@ffmpeg.org Date: Wed, 2 Feb 2022 20:01:55 -0500 Message-Id: <20220203010155.1098124-1-patrick.keroulas@radio-canada.ca> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUK104A247 smtp.mailfrom=patrick.keroulas@radio-canada.ca X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: radio-canada.ca Subject: [FFmpeg-devel] [PATCH] avformat/rtpdec_rfc4175: fix interlace format 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 Cc: Patrick Keroulas , lance.lmwang@gmail.com 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: In previous state, a new frame was allocated on each timestamp step, i.e. each frame/field transition. However, for interlace, a new frame should be allocated on 1st field, completed with the 2nd and finally freed. This commit fixes the frame allocation and the detection of missing RTP markers. Signed-off-by: Patrick Keroulas --- libavformat/rtpdec_rfc4175.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index 8e73c07838..83abe499f8 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -234,20 +234,21 @@ static int rfc4175_handle_packet(AVFormatContext *ctx, PayloadContext *data, uint8_t *dest; if (*timestamp != data->timestamp) { - if (data->frame) { + if (data->frame && (!data->interlaced || data->field)) { /* - * if we're here, it means that two RTP packets didn't have the - * same timestamp, which is a sign that they were packets from two - * different frames, but we didn't get the flag RTP_FLAG_MARKER on - * the first one of these frames (last packet of a frame). - * Finalize the previous frame anyway by filling the AVPacket. + * if we're here, it means that we missed the cue to return + * the previous AVPacket, that cue being the RTP_FLAG_MARKER + * in the last packet of either the previous frame (progressive) + * or the previous second field (interlace). Let's finalize the + * previous frame (or pair of fields) anyway by filling the AVPacket. */ av_log(ctx, AV_LOG_ERROR, "Missed previous RTP Marker\n"); missed_last_packet = 1; rfc4175_finalize_packet(data, pkt, st->index); } - data->frame = av_malloc(data->frame_size); + if (!data->frame) + data->frame = av_malloc(data->frame_size); data->timestamp = *timestamp; -- 2.25.1 _______________________________________________ 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".