[FFmpeg-cvslog] packet: initialize time_base field to (0, 1) instead of (0, 0)

Lynne git at videolan.org
Mon Aug 2 15:45:56 EEST 2021


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Mon Aug  2 14:40:57 2021 +0200| [c8b1f2bcc4767b3ab59c40c32620b2e467a6ae8d] | committer: Lynne

packet: initialize time_base field to (0, 1) instead of (0, 0)

Forget rational or irrational numbers, division by zero is undefined.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c8b1f2bcc4767b3ab59c40c32620b2e467a6ae8d
---

 libavcodec/avpacket.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 075b219475..d8d8fef3b9 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -47,7 +47,7 @@ void av_init_packet(AVPacket *pkt)
     pkt->side_data_elems      = 0;
     pkt->opaque               = NULL;
     pkt->opaque_ref           = NULL;
-    pkt->time_base            = av_make_q(0, 0);
+    pkt->time_base            = av_make_q(0, 1);
 }
 #endif
 
@@ -58,6 +58,7 @@ static void get_packet_defaults(AVPacket *pkt)
     pkt->pts             = AV_NOPTS_VALUE;
     pkt->dts             = AV_NOPTS_VALUE;
     pkt->pos             = -1;
+    pkt->time_base       = av_make_q(0, 1);
 }
 
 AVPacket *av_packet_alloc(void)



More information about the ffmpeg-cvslog mailing list