[FFmpeg-cvslog] avformat: dont run update_initial_duration() twice
Michael Niedermayer
git at videolan.org
Tue Dec 31 14:17:15 CET 2013
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Dec 31 08:36:14 2013 +0100| [4bfcedb33f7bb8aff43a32f924742ed5a4ba3edf] | committer: Michael Niedermayer
avformat: dont run update_initial_duration() twice
This should avoid floods of first_dts not matching debug messages
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4bfcedb33f7bb8aff43a32f924742ed5a4ba3edf
---
libavformat/avformat.h | 4 ++++
libavformat/utils.c | 3 +++
2 files changed, 7 insertions(+)
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 52eef0d..6d719d7 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -893,6 +893,10 @@ typedef struct AVStream {
*/
int pts_wrap_behavior;
+ /**
+ * Internal data to prevent doing update_initial_durations() twice
+ */
+ int update_initial_durations_done;
} AVStream;
AVRational av_stream_get_r_frame_rate(const AVStream *s);
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 40d886f..b0cb427 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -998,6 +998,9 @@ static void update_initial_durations(AVFormatContext *s, AVStream *st,
int64_t cur_dts= RELATIVE_TS_BASE;
if(st->first_dts != AV_NOPTS_VALUE){
+ if (st->update_initial_durations_done)
+ return;
+ st->update_initial_durations_done = 1;
cur_dts= st->first_dts;
for(; pktl; pktl= get_next_pkt(s, st, pktl)){
if(pktl->pkt.stream_index == stream_index){
More information about the ffmpeg-cvslog
mailing list