From 0ee42fcf1fc9cac716e3c8abca944537025395c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Chali=C5=84ski?= Date: Tue, 14 May 2024 23:06:44 +0200 Subject: [PATCH 1/2] fix flush crashing on stream format change --- .../converter.ex | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/membrane_ffmpeg_swresample_plugin/converter.ex b/lib/membrane_ffmpeg_swresample_plugin/converter.ex index 966df0e..138706d 100644 --- a/lib/membrane_ffmpeg_swresample_plugin/converter.ex +++ b/lib/membrane_ffmpeg_swresample_plugin/converter.ex @@ -117,14 +117,18 @@ defmodule Membrane.FFmpeg.SWResample.Converter do check_dropped_frames(state) flushed_actions = - case flush!(state.native) do - <<>> -> - [] - - converted -> - output_duration = calculate_output_duration(converted, state) - {_state, out_pts} = update_pts_queue(state, output_duration, true) - [buffer: {:output, %Buffer{payload: converted, pts: out_pts}}] + if state.native == nil do + [] + else + case flush!(state.native) do + <<>> -> + [] + + converted -> + output_duration = calculate_output_duration(converted, state) + {_state, out_pts} = update_pts_queue(state, output_duration, true) + [buffer: {:output, %Buffer{payload: converted, pts: out_pts}}] + end end # create new converter From d8beef25c9f71a8b54dbf9a23c36a28324d58bf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Chali=C5=84ski?= Date: Tue, 14 May 2024 23:07:12 +0200 Subject: [PATCH 2/2] version bump --- README.md | 2 +- mix.exs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 363735f..4ca6092 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ It is a part of [Membrane Multimedia Framework](https://membrane.stream). Add the following line to your `deps` in `mix.exs`. Run `mix deps.get`. ```elixir -{:membrane_ffmpeg_swresample_plugin, "~> 0.20.1"} +{:membrane_ffmpeg_swresample_plugin, "~> 0.20.2"} ``` The precompiled builds of the [ffmpeg](https://www.ffmpeg.org) will be pulled and linked automatically. However, should there be any problems, consider installing it manually. diff --git a/mix.exs b/mix.exs index 2c48cbe..8819aaa 100644 --- a/mix.exs +++ b/mix.exs @@ -2,7 +2,7 @@ defmodule Membrane.FFmpeg.SWResample.Mixfile do use Mix.Project @github_url "https://github.com/membraneframework/membrane_ffmpeg_swresample_plugin" - @version "0.20.1" + @version "0.20.2" def project do [