[FFmpeg-devel] [PATCH 1/1] avformat/hlsenc: Fix bug on start_pts
Lingjiang Fang
vacingfang at foxmail.com
Tue May 25 11:54:20 EEST 2021
On Sun, 16 May 2021 16:59:39 +0800
Hongcheng Zhong <sj.hc_Zhong at sjtu.edu.cn> wrote:
> From: spartazhc <spartazhc at gmail.com>
>
> This patch fixes Bug #9237
> In some bitstream, pts of some video packet can be N/A, which will set
> start_pts to AV_NOPTS_VALUE. Adding an if condition can fix it.
>
> Signed-off-by: spartazhc <spartazhc at gmail.com>
> ---
> libavformat/hlsenc.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 5db7a744b4..fd265d0ffd 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -2446,7 +2446,8 @@ static int hls_write_packet(AVFormatContext *s,
> AVPacket *pkt) if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
> vs->start_pts_from_audio = 1;
> }
> - if (vs->start_pts_from_audio && st->codecpar->codec_type ==
> AVMEDIA_TYPE_VIDEO && vs->start_pts > pkt->pts) {
> + if (vs->start_pts_from_audio && st->codecpar->codec_type ==
> AVMEDIA_TYPE_VIDEO
> + && vs->start_pts > pkt->pts && pkt->pts != AV_NOPTS_VALUE) {
maybe it's better put pkt->pts != AV_NOPTS_VALUE before pkt->pts !=
AV_NOPTS_VALUE ?
> vs->start_pts = pkt->pts;
> vs->start_pts_from_audio = 0;
> }
Regards,
Lingjiang Fang
More information about the ffmpeg-devel
mailing list