@ -26,6 +26,7 @@
# include "audio.h"
# include "avfilter.h"
# include "avfilter_internal.h"
# include "framepool.h"
# include "internal.h"
@ -44,6 +45,7 @@ AVFrame *ff_null_get_audio_buffer(AVFilterLink *link, int nb_samples)
AVFrame * ff_default_get_audio_buffer ( AVFilterLink * link , int nb_samples )
{
AVFrame * frame = NULL ;
FilterLinkInternal * const li = ff_link_internal ( link ) ;
int channels = link - > ch_layout . nb_channels ;
int align = av_cpu_max_align ( ) ;
# if FF_API_OLD_CHANNEL_LAYOUT
@ -54,10 +56,10 @@ FF_DISABLE_DEPRECATION_WARNINGS
FF_ENABLE_DEPRECATION_WARNINGS
# endif
if ( ! link - > frame_pool ) {
link - > frame_pool = ff_frame_pool_audio_init ( av_buffer_allocz , channels ,
nb_samples , link - > format , align ) ;
if ( ! link - > frame_pool )
if ( ! li - > frame_pool ) {
li - > frame_pool = ff_frame_pool_audio_init ( av_buffer_allocz , channels ,
nb_samples , link - > format , align ) ;
if ( ! li - > frame_pool )
return NULL ;
} else {
int pool_channels = 0 ;
@ -65,7 +67,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
int pool_align = 0 ;
enum AVSampleFormat pool_format = AV_SAMPLE_FMT_NONE ;
if ( ff_frame_pool_get_audio_config ( link - > frame_pool ,
if ( ff_frame_pool_get_audio_config ( li - > frame_pool ,
& pool_channels , & pool_nb_samples ,
& pool_format , & pool_align ) < 0 ) {
return NULL ;
@ -74,15 +76,15 @@ FF_ENABLE_DEPRECATION_WARNINGS
if ( pool_channels ! = channels | | pool_nb_samples < nb_samples | |
pool_format ! = link - > format | | pool_align ! = align ) {
ff_frame_pool_uninit ( ( FFFramePool * * ) & link - > frame_pool ) ;
link - > frame_pool = ff_frame_pool_audio_init ( av_buffer_allocz , channels ,
nb_samples , link - > format , align ) ;
if ( ! link - > frame_pool )
ff_frame_pool_uninit ( & li - > frame_pool ) ;
li - > frame_pool = ff_frame_pool_audio_init ( av_buffer_allocz , channels ,
nb_samples , link - > format , align ) ;
if ( ! li - > frame_pool )
return NULL ;
}
}
frame = ff_frame_pool_get ( link - > frame_pool ) ;
frame = ff_frame_pool_get ( li - > frame_pool ) ;
if ( ! frame )
return NULL ;