aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-12-22 18:47:28 +0100
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2013-12-24 07:45:32 +0100
commitb432043d556fda00b057d04d70d2835cdf828bd7 (patch)
treeb6b38615c29599a03e3804b210e869828443586a
parent94c3f8165c6af9e0d713db88045b84c09eade39e (diff)
downloadffmpeg-b432043d556fda00b057d04d70d2835cdf828bd7.tar.gz
nutenc/write_index: warn if 2 consecutive keyframes have the same PTS and discard the 2nd
This fixes an assertion failure and regression and restores previous behaviour Fixes Ticket3197 An alternative would be to fail hard in this case and refuse to mux such data. Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit de2a2caf4dedb28a959d0ff6f02751bb6c3ff033)
-rw-r--r--libavformat/nutenc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index b6d754d595..08223545b7 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -584,8 +584,15 @@ static int write_index(NUTContext *nut, AVIOContext *bc) {
int64_t last_pts= -1;
int j, k;
for (j=0; j<nut->sp_count; j++) {
- int flag = (nus->keyframe_pts[j] != AV_NOPTS_VALUE) ^ (j+1 == nut->sp_count);
+ int flag;
int n = 0;
+
+ if (j && nus->keyframe_pts[j] == nus->keyframe_pts[j-1]) {
+ av_log(nut->avf, AV_LOG_WARNING, "Multiple keyframes with same PTS\n");
+ nus->keyframe_pts[j] = AV_NOPTS_VALUE;
+ }
+
+ flag = (nus->keyframe_pts[j] != AV_NOPTS_VALUE) ^ (j+1 == nut->sp_count);
for (; j<nut->sp_count && (nus->keyframe_pts[j] != AV_NOPTS_VALUE) == flag; j++)
n++;