[FFmpeg-devel] [PATCH] Use channel count if channel layout is undefined

Michael Niedermayer michael at niedermayer.cc
Fri Jul 13 02:15:32 EEST 2018


On Tue, Jul 10, 2018 at 10:34:51AM +0100, Marcin Gorzel wrote:
> Hi Michael,
> 
> I think I know where the misunderstanding could be.
> 
> The main changes in my patch are:
> 
> rematrix.c:389 and rematrix_int.c:36:
> 
> Before:
> int nb_in  = av_get_channel_layout_nb_channels(s->in_ch_layout)
> 
> After:
> int nb_in  = s->in_ch_layout != 0
>         ? av_get_channel_layout_nb_channels(s->in_ch_layout)
>         : s->user_in_ch_count;
> 

> However, the change you are referring to (rematrix.c:72) has been made just
> to match the above changes (although you are right that functionally this
> particular one change should be the same).

This should be documented in the commit message


> I just thought that
> since av_get_channel_layout_nb_channels(s->user_in_ch_layout) was
> originally used, there may be preference to rely on the channel layout
> first (if available) before falling back to the user channel count.
> Please let me know if that makes sense.
> 
> Each field has a defined range in libswresample/options.c
> > the AVOption code checks this when setting the field
> 
> 
> > If the value in the table is wrong, thats what should be fixed.
> > If something sets it ignoring the value, that code should be fixed.
> > i dont think we should add a check without first understanding what
> > sets it outside the range
> 
> 
> I believe the check if the number of channels is valid is made in
> libavcodec/utils.c:676.

you are changing libswresample, the check in libavcodec looks unrelated
to libswresample.


> However, the output error message is quite general and possibly not very
> helpful:

Clearer error messages are certainly better, improvments to error
messages should be welcome!

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180713/ac69ecff/attachment.sig>


More information about the ffmpeg-devel mailing list