[FFmpeg-devel] avformat/flvenc: Check pts for mpeg4/h264 (which need the value)

Submitted by Michael Niedermayer on Oct. 15, 2019, 11:07 p.m.

Details

Message ID 20191015230713.23107-1-michael@niedermayer.cc
State Accepted
Commit 14d3384cf31a620ff451062f7263942f7fe3a972
Headers show

Commit Message

Michael Niedermayer Oct. 15, 2019, 11:07 p.m.
Fixes: Ticket8152

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/flvenc.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Michael Niedermayer Nov. 9, 2019, 3:01 p.m.
On Wed, Oct 16, 2019 at 01:07:13AM +0200, Michael Niedermayer wrote:
> Fixes: Ticket8152
> 
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/flvenc.c | 6 ++++++
>  1 file changed, 6 insertions(+)

will apply

[...]

Patch hide | download patch | download mbox

diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index fb1dede7ae..eb52b473b8 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -928,6 +928,12 @@  static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
                "Packets are not in the proper order with respect to DTS\n");
         return AVERROR(EINVAL);
     }
+    if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4) {
+        if (pkt->pts == AV_NOPTS_VALUE) {
+            av_log(s, AV_LOG_ERROR, "Packet is missing PTS\n");
+            return AVERROR(EINVAL);
+        }
+    }
 
     ts = pkt->dts;