[FFmpeg-devel] [PATCH 1/6] avformat/utils: do not overwrite already existing program with defaults in av_new_program

Marton Balint cus at passwd.hu
Tue Dec 29 00:49:24 EET 2020


av_new_program returns the existing program if that already exists, in that
case it makes no sense to overwrite existing attributes.

Signed-off-by: Marton Balint <cus at passwd.hu>
---
 libavformat/utils.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 1a87d9422a..270ed8d4f2 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4568,14 +4568,12 @@ AVProgram *av_new_program(AVFormatContext *ac, int id)
         dynarray_add(&ac->programs, &ac->nb_programs, program);
         program->discard = AVDISCARD_NONE;
         program->pmt_version = -1;
+        program->id = id;
+        program->pts_wrap_reference = AV_NOPTS_VALUE;
+        program->pts_wrap_behavior = AV_PTS_WRAP_IGNORE;
+        program->start_time =
+        program->end_time   = AV_NOPTS_VALUE;
     }
-    program->id = id;
-    program->pts_wrap_reference = AV_NOPTS_VALUE;
-    program->pts_wrap_behavior = AV_PTS_WRAP_IGNORE;
-
-    program->start_time =
-    program->end_time   = AV_NOPTS_VALUE;
-
     return program;
 }
 
-- 
2.26.2



More information about the ffmpeg-devel mailing list