[FFmpeg-cvslog] avformat/mov: Simplify last element computation in mov_estimate_video_delay()

Michael Niedermayer git at videolan.org
Mon Jul 16 20:04:10 EEST 2018


ffmpeg | branch: release/4.0 | Michael Niedermayer <michael at niedermayer.cc> | Wed Jul 11 02:17:57 2018 +0200| [670b565ba2b1074290b4a5bcf6f4c6ff55e9c68c] | committer: Michael Niedermayer

avformat/mov: Simplify last element computation in mov_estimate_video_delay()

Reviewed-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
Reviewed-by: Sasi Inguva <isasi at google.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit b0644f7f72a9ae64c7285d26ec720441c25d4cf5)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=670b565ba2b1074290b4a5bcf6f4c6ff55e9c68c
---

 libavformat/mov.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index b0a50fbc54..ff95154e60 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3308,13 +3308,12 @@ static void mov_estimate_video_delay(MOVContext *c, AVStream* st) {
         st->codecpar->codec_id == AV_CODEC_ID_H264) {
         st->codecpar->video_delay = 0;
         for(ind = 0; ind < st->nb_index_entries && ctts_ind < msc->ctts_count; ++ind) {
+            // Point j to the last elem of the buffer and insert the current pts there.
+            j = buf_start;
             buf_start = (buf_start + 1);
             if (buf_start == MAX_REORDER_DELAY + 1)
                 buf_start = 0;
 
-            // Point j to the last elem of the buffer and insert the current pts there.
-            j = buf_start - 1;
-            if (j < 0) j = MAX_REORDER_DELAY;
             pts_buf[j] = st->index_entries[ind].timestamp + msc->ctts_data[ctts_ind].duration;
 
             // The timestamps that are already in the sorted buffer, and are greater than the



More information about the ffmpeg-cvslog mailing list