diff mbox

[FFmpeg-devel,3/4] avformat/mov: Simplify last element computation in mov_estimate_video_delay()

Message ID 20180711001758.27132-3-michael@niedermayer.cc
State Accepted
Commit b0644f7f72a9ae64c7285d26ec720441c25d4cf5
Headers show

Commit Message

Michael Niedermayer July 11, 2018, 12:17 a.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/mov.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Sasi Inguva July 11, 2018, 6:32 p.m. UTC | #1
LGTM.

On Tue, Jul 10, 2018 at 5:18 PM Michael Niedermayer <michael@niedermayer.cc>
wrote:

> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/mov.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 67b3e11eb9..951a337cca 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -3310,13 +3310,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
> --
> 2.18.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
Michael Niedermayer July 12, 2018, 12:04 p.m. UTC | #2
On Wed, Jul 11, 2018 at 11:32:33AM -0700, Sasi Inguva wrote:
> LGTM.

will apply

thx

[...]
diff mbox

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 67b3e11eb9..951a337cca 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3310,13 +3310,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