[FFmpeg-devel,mov] When both edit list and start padding present, take maximum.

Submitted by Sasi Inguva on Oct. 18, 2017, 11 p.m.

Details

Message ID CAGD_KHd-Wb6iVC=QTgXsFmZ=g2ddD18MDJvprFN_4D1mhLzOng@mail.gmail.com
State New
Headers show

Commit Message

Sasi Inguva Oct. 18, 2017, 11 p.m.
Thanks for the patch. The bug is because mov_fix_index updates skip_samples
correctly, but not start_pad. Can you instead of taking the max, just
update the mov_fix_index function so that start_pad = skip_samples always.
Something like this
                         }
                     }
                 }
@@ -3324,6 +3323,8 @@ static void mov_fix_index(MOVContext *mov, AVStream
*st)
     // Update av stream length
     st->duration = edit_list_dts_entry_end - start_dts;

+    msc->start_pad = st->skip_samples;
+
     // Free the old index and the old CTTS structures
     av_free(e_old);
     av_free(ctts_data_old);


Thanks.

On Mon, Oct 16, 2017 at 2:25 PM, Dale Curtis <dalecurtis@chromium.org>
wrote:

> More details on the issue which uncovered this can be seen here
> https://bugs.chromium.org/p/chromium/issues/detail?id=775042#c13
>
> - dale
>
> On Mon, Oct 16, 2017 at 2:22 PM, Dale Curtis <dalecurtis@chromium.org>
> wrote:
>
>> Previously the start padding was used to blindly overwrite any skip
>> samples which may have come from an edit list. Instead take the maximum of
>> the two.
>>
>> A new fate test is added, fate-mov-440hz-10ms, to ensure this is handled
>> correctly.
>>
>> The sample can be downloaded and added to the fate-suite from
>>
>> https://cs.chromium.org/chromium/src/third_party/WebKit/
>> LayoutTests/webaudio/resources/media/440hz-10ms.m4a
>>
>> - dale
>>
>
>

Comments

Dale Curtis Oct. 18, 2017, 11:14 p.m.
On Wed, Oct 18, 2017 at 4:00 PM, Sasi Inguva <isasi@google.com> wrote:

> Thanks for the patch. The bug is because mov_fix_index updates
> skip_samples correctly, but not start_pad. Can you instead of taking the
> max, just update the mov_fix_index function so that start_pad =
> skip_samples always. Something like this
>

Thanks this works. Patch attached.
Sasi Inguva Oct. 18, 2017, 11:23 p.m.
Patch LGTM. Thanks.

On Wed, Oct 18, 2017 at 4:14 PM, Dale Curtis <dalecurtis@chromium.org>
wrote:

> On Wed, Oct 18, 2017 at 4:00 PM, Sasi Inguva <isasi@google.com> wrote:
>
>> Thanks for the patch. The bug is because mov_fix_index updates
>> skip_samples correctly, but not start_pad. Can you instead of taking the
>> max, just update the mov_fix_index function so that start_pad =
>> skip_samples always. Something like this
>>
>
> Thanks this works. Patch attached.
>
>
>
Michael Niedermayer Oct. 21, 2017, 1:10 a.m.
On Wed, Oct 18, 2017 at 04:23:04PM -0700, Sasi Inguva wrote:
> Patch LGTM. Thanks.

will apply

thanks

[...]

Patch hide | download patch | download mbox

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 899690d920..355e1d09fd 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3249,7 +3249,6 @@  static void mov_fix_index(MOVContext *mov, AVStream
*st)
                         // Increment skip_samples for the first non-zero
audio edit list
                         if (first_non_zero_audio_edit > 0 &&
st->codecpar->codec_id != AV_CODEC_ID_VORBIS) {
                             st->skip_samples += frame_duration;
-                            msc->start_pad = st->skip_samples;