[FFmpeg-devel] [PATCH] avutil/frame: fix av_frame_copy for unknown layouts

wm4 nfxjfg at googlemail.com
Mon Jan 30 09:40:01 EET 2017


On Mon, 30 Jan 2017 01:37:02 +0100
Marton Balint <cus at passwd.hu> wrote:

> I wonder how unknown layouts ever worked without this?
> 
> Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
>  libavutil/frame.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavutil/frame.c b/libavutil/frame.c
> index c2f5509..a08e0c5 100644
> --- a/libavutil/frame.c
> +++ b/libavutil/frame.c
> @@ -725,7 +725,7 @@ int av_frame_copy(AVFrame *dst, const AVFrame *src)
>  
>      if (dst->width > 0 && dst->height > 0)
>          return frame_copy_video(dst, src);
> -    else if (dst->nb_samples > 0 && dst->channel_layout)
> +    else if (dst->nb_samples > 0 && dst->channels > 0)
>          return frame_copy_audio(dst, src);
>  
>      return AVERROR(EINVAL);

The original code was written with the assumption that only channel
layouts exist in the AVFrame. And the Libav API follows that. This
patch will probably break Libav API users (or those who want to stay
compatible to them) some more.


More information about the ffmpeg-devel mailing list