diff --git a/src/filter/plugins/FfmpegFilter.cxx b/src/filter/plugins/FfmpegFilter.cxx index f61d3415d..0bdae78e2 100644 --- a/src/filter/plugins/FfmpegFilter.cxx +++ b/src/filter/plugins/FfmpegFilter.cxx @@ -37,12 +37,12 @@ FfmpegFilter::FfmpegFilter(const AudioFormat &in_audio_format, graph(std::move(_graph)), buffer_src(std::move(_buffer_src)), buffer_sink(std::move(_buffer_sink)), + in_format(Ffmpeg::ToFfmpegSampleFormat(in_audio_format.format)), + in_sample_rate(in_audio_format.sample_rate), + in_channels(in_audio_format.channels), in_audio_frame_size(in_audio_format.GetFrameSize()), out_audio_frame_size(_out_audio_format.GetFrameSize()) { - in_frame->format = Ffmpeg::ToFfmpegSampleFormat(in_audio_format.format); - in_frame->sample_rate = in_audio_format.sample_rate; - in_frame->channels = in_audio_format.channels; } ConstBuffer @@ -50,6 +50,10 @@ FfmpegFilter::FilterPCM(ConstBuffer src) { /* submit source data into the FFmpeg audio buffer source */ + in_frame.Unref(); + in_frame->format = in_format; + in_frame->sample_rate = in_sample_rate; + in_frame->channels = in_channels; in_frame->nb_samples = src.size / in_audio_frame_size; in_frame.GetBuffer(); diff --git a/src/filter/plugins/FfmpegFilter.hxx b/src/filter/plugins/FfmpegFilter.hxx index 640a81eb3..0c6612a8b 100644 --- a/src/filter/plugins/FfmpegFilter.hxx +++ b/src/filter/plugins/FfmpegFilter.hxx @@ -32,6 +32,8 @@ class FfmpegFilter final : public Filter { Ffmpeg::FilterContext buffer_src, buffer_sink; Ffmpeg::Frame in_frame, out_frame; + const int in_format, in_sample_rate, in_channels; + const size_t in_audio_frame_size; const size_t out_audio_frame_size;