File tree Expand file tree Collapse file tree
lib/membrane_ffmpeg_swresample_plugin Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -211,23 +211,10 @@ defmodule Membrane.FFmpeg.SWResample.Converter do
211211 end
212212
213213 defp resolve_output_stream_format ( input_format , output_format ) do
214- % RawAudio {
215- sample_format:
216- if ( output_format . sample_format == :keep ,
217- do: input_format . sample_format ,
218- else: output_format . sample_format
219- ) ,
220- sample_rate:
221- if ( output_format . sample_rate == :keep ,
222- do: input_format . sample_rate ,
223- else: output_format . sample_rate
224- ) ,
225- channels:
226- if ( output_format . channels == :keep ,
227- do: input_format . channels ,
228- else: output_format . channels
229- )
230- }
214+ overrides =
215+ output_format |> Map . from_struct ( ) |> Map . reject ( fn { _key , val } -> val == :keep end )
216+
217+ struct! ( RawAudio , Map . merge ( input_format , overrides ) )
231218 end
232219
233220 defp check_dropped_frames ( state ) do
You can’t perform that action at this time.
0 commit comments