From: lance.lmwang@gmail.com
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] avformat/rtpdec_rfc4175: fix interlace format
Date: Fri, 4 Feb 2022 11:23:36 +0800
Message-ID: <20220204032336.GA24526@gmail.com> (raw)
In-Reply-To: <20220202204510.1091477-1-patrick.keroulas@radio-canada.ca>
On Wed, Feb 02, 2022 at 03:45:10PM -0500, Patrick Keroulas wrote:
> 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 <patrick.keroulas@radio-canada.ca>
> ---
> 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;
LGTM
>
> --
> 2.25.1
>
--
Thanks,
Limin Wang
_______________________________________________
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".
next parent reply other threads:[~2022-02-04 3:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220202204510.1091477-1-patrick.keroulas@radio-canada.ca>
2022-02-04 3:23 ` lance.lmwang [this message]
2022-02-05 3:46 ` lance.lmwang
2022-02-03 1:01 Patrick Keroulas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220204032336.GA24526@gmail.com \
--to=lance.lmwang@gmail.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git