Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Reviewed-by: Sasi Inguva <isasi@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b0644f7f72a9ae64c7285d26ec720441c25d4cf5)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
... | ... |
@@ -3308,13 +3308,12 @@ static void mov_estimate_video_delay(MOVContext *c, AVStream* st) { |
3308 | 3308 |
st->codecpar->codec_id == AV_CODEC_ID_H264) { |
3309 | 3309 |
st->codecpar->video_delay = 0; |
3310 | 3310 |
for(ind = 0; ind < st->nb_index_entries && ctts_ind < msc->ctts_count; ++ind) { |
3311 |
+ // Point j to the last elem of the buffer and insert the current pts there. |
|
3312 |
+ j = buf_start; |
|
3311 | 3313 |
buf_start = (buf_start + 1); |
3312 | 3314 |
if (buf_start == MAX_REORDER_DELAY + 1) |
3313 | 3315 |
buf_start = 0; |
3314 | 3316 |
|
3315 |
- // Point j to the last elem of the buffer and insert the current pts there. |
|
3316 |
- j = buf_start - 1; |
|
3317 |
- if (j < 0) j = MAX_REORDER_DELAY; |
|
3318 | 3317 |
pts_buf[j] = st->index_entries[ind].timestamp + msc->ctts_data[ctts_ind].duration; |
3319 | 3318 |
|
3320 | 3319 |
// The timestamps that are already in the sorted buffer, and are greater than the |