---
 libavcodec/hw_base_encode.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hw_base_encode.c b/libavcodec/hw_base_encode.c
index 307e76ed79..e7b2d30e6e 100644
--- a/libavcodec/hw_base_encode.c
+++ b/libavcodec/hw_base_encode.c
@@ -507,8 +507,10 @@ static int hw_base_encode_send_frame(AVCodecContext 
*avctx, FFHWBaseEncodeContex
         ctx->end_of_stream = 1;
 
         // Fix timestamps if we hit end-of-stream before the initial decode
-        // delay has elapsed.
-        if (ctx->input_order <= ctx->decode_delay)
+        // delay has elapsed. If no frame was ever sent (pic_end is still
+        // NULL), there is nothing to fix up -- and no packets will be
+        // produced either, so this is safe to skip entirely
+        if (ctx->input_order <= ctx->decode_delay && ctx->pic_end)
             ctx->dts_pts_diff = ctx->pic_end->pts - ctx->first_pts;
     }
 
-- 
2.53.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to