Commit b432043d authored by Michael Niedermayer's avatar Michael Niedermayer Committed by Carl Eugen Hoyos

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: 's avatarMichael Niedermayer <michaelni@gmx.at>
(cherry picked from commit de2a2caf)
parent 94c3f816
...@@ -584,8 +584,15 @@ static int write_index(NUTContext *nut, AVIOContext *bc) { ...@@ -584,8 +584,15 @@ static int write_index(NUTContext *nut, AVIOContext *bc) {
int64_t last_pts= -1; int64_t last_pts= -1;
int j, k; int j, k;
for (j=0; j<nut->sp_count; j++) { 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; 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++) for (; j<nut->sp_count && (nus->keyframe_pts[j] != AV_NOPTS_VALUE) == flag; j++)
n++; n++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment