[FFmpeg-cvslog] avformat/utils: do not overwrite already existing program with defaults in av_new_program

Marton Balint git at videolan.org
Sun Jan 10 01:26:03 EET 2021


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Sun Dec 27 20:32:54 2020 +0100| [9298e8eb61f6c796aaf7c6e14e59f345318d2753] | committer: Marton Balint

avformat/utils: do not overwrite already existing program with defaults in av_new_program

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>

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

 libavformat/utils.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 3ba4ae4123..c52f39e1b7 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4590,14 +4590,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;
 }
 



More information about the ffmpeg-cvslog mailing list