[FFmpeg-devel] [PATCH] Revert "Merge commit '9f1eccb97bf8894cb18b14f642500686505ef186'"

Hendrik Leppkes h.leppkes at gmail.com
Fri Jan 1 16:48:12 CET 2016


On Fri, Jan 1, 2016 at 4:37 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> From: Michael Niedermayer <michael at niedermayer.cc>
>
> This unbreaks encoding
> Example:
> ffmpeg -i matrixbench_mpeg2.mpg new.avi
>
> -rw-r----- 1 michael michael 226035354 Jan  1 16:27 new.avi
> -rw-r----- 1 michael michael  10016802 Jan  1 16:28 ref.avi
>
> Also av_get_audio_frame_duration() itself uses frame_size
>
> This reverts commit 29e6606e9b42aa811be995e2fcdea4806911bc9f, reversing
> changes made to 53448461a7720afab0d1f1234af79573fd2e020d.
> ---
>  libavformat/riffenc.c |    5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c
> index 250cf41..ceb27f2 100644
> --- a/libavformat/riffenc.c
> +++ b/libavformat/riffenc.c
> @@ -242,7 +242,12 @@ void ff_parse_specific_params(AVStream *st, int *au_rate,
>      int gcd;
>      int audio_frame_size;
>
> +    /* We use the known constant frame size for the codec if known, otherwise
> +     * fall back on using AVCodecContext.frame_size, which is not as reliable
> +     * for indicating packet duration. */
>      audio_frame_size = av_get_audio_frame_duration(codec, 0);
> +    if (!audio_frame_size)
> +        audio_frame_size = codec->frame_size;
>
>      *au_ssize = codec->block_align;
>      if (audio_frame_size && codec->sample_rate) {
> --

Using the AVCodecContext from a muxer is deprecated, and sooner or
later this code will have to be "fixed" again to no longer rely on
this parameter when calling code no longer provides this parameter. So
better would be to figure out why it needs special handling here.
The comment above it even says that its not reliable.

Feel free to commit in the meantime, but this is going to break again
in the future if not fixed properly.

-  Hendrik


More information about the ffmpeg-devel mailing list