@ -2353,12 +2353,13 @@ static int audio_decode_frame(VideoState *is)
av_channel_layout_compare ( & af - > frame - > ch_layout , & is - > audio_src . ch_layout ) | |
av_channel_layout_compare ( & af - > frame - > ch_layout , & is - > audio_src . ch_layout ) | |
af - > frame - > sample_rate ! = is - > audio_src . freq | |
af - > frame - > sample_rate ! = is - > audio_src . freq | |
( wanted_nb_samples ! = af - > frame - > nb_samples & & ! is - > swr_ctx ) ) {
( wanted_nb_samples ! = af - > frame - > nb_samples & & ! is - > swr_ctx ) ) {
int ret ;
swr_free ( & is - > swr_ctx ) ;
swr_free ( & is - > swr_ctx ) ;
swr_alloc_set_opts2 ( & is - > swr_ctx ,
ret = swr_alloc_set_opts2 ( & is - > swr_ctx ,
& is - > audio_tgt . ch_layout , is - > audio_tgt . fmt , is - > audio_tgt . freq ,
& is - > audio_tgt . ch_layout , is - > audio_tgt . fmt , is - > audio_tgt . freq ,
& af - > frame - > ch_layout , af - > frame - > format , af - > frame - > sample_rate ,
& af - > frame - > ch_layout , af - > frame - > format , af - > frame - > sample_rate ,
0 , NULL ) ;
0 , NULL ) ;
if ( ! is - > swr_ctx | | swr_init ( is - > swr_ctx ) < 0 ) {
if ( ret < 0 | | swr_init ( is - > swr_ctx ) < 0 ) {
av_log ( NULL , AV_LOG_ERROR ,
av_log ( NULL , AV_LOG_ERROR ,
" Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels! \n " ,
" Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels! \n " ,
af - > frame - > sample_rate , av_get_sample_fmt_name ( af - > frame - > format ) , af - > frame - > ch_layout . nb_channels ,
af - > frame - > sample_rate , av_get_sample_fmt_name ( af - > frame - > format ) , af - > frame - > ch_layout . nb_channels ,