Commit dd5208aa authored by Xiaohan Wang's avatar Xiaohan Wang Committed by Michael Niedermayer

avformat/mov: Fix ctts_index calculation

An index should never be equal to the count. Hence we must make sure
*ctts_index < ctts_count.
Reviewed-by: 's avatarSasi Inguva <isasi@google.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 909e00ae
...@@ -3132,7 +3132,7 @@ static int find_prev_closest_index(AVStream *st, ...@@ -3132,7 +3132,7 @@ static int find_prev_closest_index(AVStream *st,
} }
} }
while (*index >= 0 && (*ctts_index) >= 0) { while (*index >= 0 && (*ctts_index) >= 0 && (*ctts_index) < ctts_count) {
// Find a "key frame" with PTS <= timestamp_pts (So that we can decode B-frames correctly). // Find a "key frame" with PTS <= timestamp_pts (So that we can decode B-frames correctly).
// No need to add dts_shift to the timestamp here becase timestamp_pts has already been // No need to add dts_shift to the timestamp here becase timestamp_pts has already been
// compensated by dts_shift above. // compensated by dts_shift above.
......
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