On 02/19/2017 02:57 PM, John Stebbins wrote:
> initial_padding was getting added to the edit list indirectly due to
> initial negative dts.  But in cases where the audio is delayed,
> all or part of initial_padding would be unaccounted for.  This patch
> makes initial_padding explicit.
> ---
>  libavformat/movenc.c | 53 
> +++++++++++++++++++++++++++++++++++++---------------
>  1 file changed, 38 insertions(+), 15 deletions(-)
>
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index 689291d..cc967dc 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -1698,9 +1698,28 @@ static int mov_write_edts_tag(AVIOContext *pb, 
> MOVMuxContext *mov,
>                                        track->timescale, AV_ROUND_UP);
>      int version = duration < INT32_MAX ? 0 : 1;
>      int entry_size, entry_count, size;
> -    int64_t delay, start_ct = track->start_cts;
> -    delay = av_rescale_rnd(track->start_dts + start_ct, MOV_TIMESCALE,
> +    int64_t delay;
> +    int64_t mediatime;
> +    int64_t skip = 0;
> +
> +    delay = av_rescale_rnd(track->start_dts + track->start_cts, 
> MOV_TIMESCALE,
>                             track->timescale, AV_ROUND_DOWN);
> +
> +    if (track->par->codec_type == AVMEDIA_TYPE_AUDIO &&
> +        track->par->initial_padding > 0) {
> +        /* Adjust delay so that initial_padding gets recorded in the
> +         * MediaTime of an edit list entry even in the case that
> +         * delay is positive. I.e. we don't want initial_delay to be

Ugh! Should be initial_padding, not initial_delay.  Sending update...

-- 
John      GnuPG fingerprint: D0EC B3DB C372 D1F1 0B01  83F0 49F1 D7B2 60D4 D0F7


Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to