diff mbox

[FFmpeg-devel] lavf/mov.c: Don't correct edit list start to zero, when we can't find a frame before edit list start. After c2a8f0fcbe57ea9ccaa864130f078af10516c3c1 this can happen on normal edit lists starting on a B-frame.

Message ID 20171114001533.20083-1-isasi@google.com
State Superseded
Headers show

Commit Message

Sasi Inguva Nov. 14, 2017, 12:15 a.m. UTC
Signed-off-by: Sasi Inguva <isasi@google.com>
---
 libavformat/mov.c  | 4 +---
 tests/fate/mov.mak | 6 ++++++
 2 files changed, 7 insertions(+), 3 deletions(-)

Comments

Sasi Inguva Nov. 14, 2017, 2:09 a.m. UTC | #1
Forgot the fate REF file. Sending the full patch again.

On Mon, Nov 13, 2017 at 4:15 PM, Sasi Inguva <isasi@google.com> wrote:

> Signed-off-by: Sasi Inguva <isasi@google.com>
> ---
>  libavformat/mov.c  | 4 +---
>  tests/fate/mov.mak | 6 ++++++
>  2 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index fd170baa57..79023ef369 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -3380,13 +3380,11 @@ static void mov_fix_index(MOVContext *mov,
> AVStream *st)
>              if (find_prev_closest_index(st, e_old, nb_old, ctts_data_old,
> ctts_count_old, search_timestamp, AVSEEK_FLAG_ANY,
>                                          &index, &ctts_index_old,
> &ctts_sample_old) < 0) {
>                  av_log(mov->fc, AV_LOG_WARNING,
> -                       "st: %d edit list %"PRId64" Cannot find an index
> entry before timestamp: %"PRId64".\n"
> -                       "Rounding edit list media time to zero.\n",
> +                       "st: %d edit list %"PRId64" Cannot find an index
> entry before timestamp: %"PRId64".\n",
>                         st->index, edit_list_index, search_timestamp);
>                  index = 0;
>                  ctts_index_old = 0;
>                  ctts_sample_old = 0;
> -                edit_list_media_time = 0;
>              }
>          }
>          current = e_old + index;
> diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
> index 76f66ff498..c1a3d154e0 100644
> --- a/tests/fate/mov.mak
> +++ b/tests/fate/mov.mak
> @@ -11,6 +11,7 @@ FATE_MOV = fate-mov-3elist \
>             fate-mov-440hz-10ms \
>             fate-mov-ibi-elst-starts-b \
>             fate-mov-elst-ends-betn-b-and-i \
> +           fate-mov-bbi-elst-starts-b \
>
>  FATE_MOV_FFPROBE = fate-mov-aac-2048-priming \
>                     fate-mov-zombie \
> @@ -59,6 +60,11 @@ fate-mov-invalid-elst-entry-count: CMD = framemd5
> -flags +bitexact -i $(TARGET_S
>  # i.e.  Pts Order: I-B-I
>  fate-mov-ibi-elst-starts-b: CMD = framemd5 -flags +bitexact -i
> $(TARGET_SAMPLES)/mov/mov_ibi_elst_starts_b.mov
>
> +# Makes sure that we pick the right frames according to edit list when
> there is no keyframe with PTS < edit list start.
> +# For example, when video starts on a B-frame, and edit list starts on
> that B-frame too.
> +# GOP structure : B B I in presentation order.
> +fate-mov-bbi-elst-starts-b: CMD = framemd5 -flags +bitexact -i
> $(TARGET_SAMPLES)/h264/twofields_packet.mp4
> +
>  fate-mov-aac-2048-priming: CMD = run ffprobe$(PROGSSUF)$(EXESUF)
> -show_packets -print_format compact $(TARGET_SAMPLES)/mov/aac-
> 2048-priming.mov
>
>  fate-mov-zombie: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_streams
> -show_packets -show_frames -bitexact -print_format compact
> $(TARGET_SAMPLES)/mov/white_zombie_scrunch-part.mov
> --
> 2.15.0.448.gf294e3d99a-goog
>
>
diff mbox

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index fd170baa57..79023ef369 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3380,13 +3380,11 @@  static void mov_fix_index(MOVContext *mov, AVStream *st)
             if (find_prev_closest_index(st, e_old, nb_old, ctts_data_old, ctts_count_old, search_timestamp, AVSEEK_FLAG_ANY,
                                         &index, &ctts_index_old, &ctts_sample_old) < 0) {
                 av_log(mov->fc, AV_LOG_WARNING,
-                       "st: %d edit list %"PRId64" Cannot find an index entry before timestamp: %"PRId64".\n"
-                       "Rounding edit list media time to zero.\n",
+                       "st: %d edit list %"PRId64" Cannot find an index entry before timestamp: %"PRId64".\n",
                        st->index, edit_list_index, search_timestamp);
                 index = 0;
                 ctts_index_old = 0;
                 ctts_sample_old = 0;
-                edit_list_media_time = 0;
             }
         }
         current = e_old + index;
diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index 76f66ff498..c1a3d154e0 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -11,6 +11,7 @@  FATE_MOV = fate-mov-3elist \
            fate-mov-440hz-10ms \
            fate-mov-ibi-elst-starts-b \
            fate-mov-elst-ends-betn-b-and-i \
+           fate-mov-bbi-elst-starts-b \
 
 FATE_MOV_FFPROBE = fate-mov-aac-2048-priming \
                    fate-mov-zombie \
@@ -59,6 +60,11 @@  fate-mov-invalid-elst-entry-count: CMD = framemd5 -flags +bitexact -i $(TARGET_S
 # i.e.  Pts Order: I-B-I
 fate-mov-ibi-elst-starts-b: CMD = framemd5 -flags +bitexact -i $(TARGET_SAMPLES)/mov/mov_ibi_elst_starts_b.mov
 
+# Makes sure that we pick the right frames according to edit list when there is no keyframe with PTS < edit list start.
+# For example, when video starts on a B-frame, and edit list starts on that B-frame too.
+# GOP structure : B B I in presentation order.
+fate-mov-bbi-elst-starts-b: CMD = framemd5 -flags +bitexact -i $(TARGET_SAMPLES)/h264/twofields_packet.mp4
+
 fate-mov-aac-2048-priming: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_packets -print_format compact $(TARGET_SAMPLES)/mov/aac-2048-priming.mov
 
 fate-mov-zombie: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_streams -show_packets -show_frames -bitexact -print_format compact $(TARGET_SAMPLES)/mov/white_zombie_scrunch-part.mov