From c2f6844ebcc9c1c3c520a20f551bc65863a53ebd Mon Sep 17 00:00:00 2001 From: Daniel Barta Date: Fri, 25 Oct 2024 17:02:41 +0200 Subject: [PATCH] fix: handle negative timestamp The previous behavior caused an ambigious state in read_av_packet when the stream started with multiple packets with negative pts --- lib/web-demuxer/web_demuxer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web-demuxer/web_demuxer.cpp b/lib/web-demuxer/web_demuxer.cpp index 74bc727..8819ff6 100644 --- a/lib/web-demuxer/web_demuxer.cpp +++ b/lib/web-demuxer/web_demuxer.cpp @@ -129,7 +129,7 @@ void gen_web_packet(WebAVPacket &web_packet, AVPacket *packet, AVStream *stream) double packet_timestamp = packet->pts * av_q2d(stream->time_base); web_packet.keyframe = packet->flags & AV_PKT_FLAG_KEY; - web_packet.timestamp = packet_timestamp > 0 ? packet_timestamp : 0; + web_packet.timestamp = packet_timestamp; web_packet.duration = packet->duration * av_q2d(stream->time_base); web_packet.size = packet->size; if (packet->size > 0)