-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix sps pps sps and add GOP and rename Fishjam (#18)
* Add gop size * Update to fishjam * Add filter H264 * Add test for melting * Apply review changes * Fix credo issue * Refactor FilterH264 * Fix pps and sps once again * Fix credo issue * Changes after review
- Loading branch information
Showing
12 changed files
with
106 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
defmodule RecordingConverter.FilterH264 do | ||
@moduledoc false | ||
|
||
use Membrane.Filter | ||
|
||
require Logger | ||
|
||
alias Membrane.Buffer | ||
|
||
def_input_pad :input, accepted_format: Membrane.H264 | ||
|
||
def_output_pad :output, accepted_format: Membrane.H264 | ||
|
||
@impl true | ||
def handle_init(_ctx, _options) do | ||
{[], %{}} | ||
end | ||
|
||
@impl true | ||
def handle_buffer(_pad, %Buffer{} = buffer, _ctx, state) do | ||
type = buffer.metadata.h264.type | ||
|
||
cond do | ||
type in [:sps, :pps] -> | ||
{[], Map.put(state, type, buffer)} | ||
|
||
is_map_key(state, :sps) and is_map_key(state, :pps) -> | ||
buffers = [state.sps, state.pps, buffer] | ||
|
||
{[buffer: {:output, buffers}], %{}} | ||
|
||
map_size(state) > 0 -> | ||
raise "Stream lacks sps or pps which will lead to decoder deadlock" | ||
|
||
true -> | ||
{[buffer: {:output, buffer}], state} | ||
end | ||
end | ||
|
||
@impl true | ||
def handle_end_of_stream(_pad, _ctx, state) do | ||
buffers = [Map.get(state, :sps), Map.get(state, :pps)] |> Enum.reject(&is_nil/1) | ||
|
||
{[buffer: {:output, buffers}, end_of_stream: :output], state} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"recording_id": "37", | ||
"tracks": { | ||
"1cf1a2a8-e30c-47bf-a209-0619cc3847be.msr": { | ||
"offset": 3594174959, | ||
"type": "video", | ||
"origin": "7b125ebc-5d5d-4fa5-ad4b-1607e9a4c6ec", | ||
"encoding": "H264", | ||
"metadata": null, | ||
"clock_rate": 90000, | ||
"start_timestamp": 3643725625, | ||
"end_timestamp": 3646057795 | ||
}, | ||
"a8dc8319-b609-4be0-8969-6f9fdb4c6f11.msr": { | ||
"offset": 0, | ||
"type": "video", | ||
"origin": "2939faaf-ddfe-43f5-a6ee-af97a09c9e78", | ||
"encoding": "H264", | ||
"metadata": null, | ||
"clock_rate": 90000, | ||
"start_timestamp": 49550666, | ||
"end_timestamp": 50499087 | ||
}, | ||
"f4713f9b-1adb-4b48-9246-9dc6ba6aaee0.msr": { | ||
"offset": 3288245581, | ||
"type": "video", | ||
"origin": "7b125ebc-5d5d-4fa5-ad4b-1607e9a4c6ec", | ||
"encoding": "H264", | ||
"metadata": null, | ||
"clock_rate": 90000, | ||
"start_timestamp": 3337796247, | ||
"end_timestamp": 3341106897 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters