You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
avfilter_get_audio_buffer_ref_from_frame: check that layout and channels match if they are set
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -93,10 +93,16 @@ AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_frame(const AVFrame *frame
|
|||||||
int perms)
|
int perms)
|
||||||
{
|
{
|
||||||
AVFilterBufferRef *samplesref;
|
AVFilterBufferRef *samplesref;
|
||||||
|
int64_t layout = av_frame_get_channel_layout(frame);
|
||||||
|
|
||||||
if(av_frame_get_channels(frame) > 8) // libavfilter does not suport more than 8 channels FIXME, remove once libavfilter is fixed
|
if(av_frame_get_channels(frame) > 8) // libavfilter does not suport more than 8 channels FIXME, remove once libavfilter is fixed
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (layout && av_get_channel_layout_nb_channels(layout) != av_frame_get_channels(frame)) {
|
||||||
|
av_log(0, AV_LOG_ERROR, "Layout indicates a differnt number of channels than actually present\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
samplesref = avfilter_get_audio_buffer_ref_from_arrays((uint8_t **)frame->data, frame->linesize[0], perms,
|
samplesref = avfilter_get_audio_buffer_ref_from_arrays((uint8_t **)frame->data, frame->linesize[0], perms,
|
||||||
frame->nb_samples, frame->format,
|
frame->nb_samples, frame->format,
|
||||||
av_frame_get_channel_layout(frame));
|
av_frame_get_channel_layout(frame));
|
||||||
|
Reference in New Issue
Block a user