Skip to content

Commit

Permalink
Fix stream format (#63)
Browse files Browse the repository at this point in the history
* Update h264_parser.ex

* allow %RemoteStream{type: :packetized} in parsers
  • Loading branch information
mat-hek committed May 14, 2024
1 parent 14ff3bf commit a43f00e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lib/membrane_h264_plugin/h264_parser.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ defmodule Membrane.H264.Parser do
* `:au_aligned` - each input buffer contains a single access unit's payload
The parser's mode is set automatically, based on the input stream format received by that element:
* Receiving `%Membrane.RemoteStream{type: :bytestream}` results in the parser mode being set to `:bytestream`
* Receiving `Membrane.RemoteStream` results in the parser mode being set to `:bytestream`
* Receiving `%Membrane.H264{alignment: :nalu}` results in the parser mode being set to `:nalu_aligned`
* Receiving `%Membrane.H264{alignment: :au}` results in the parser mode being set to `:au_aligned`
Expand Down Expand Up @@ -57,7 +57,7 @@ defmodule Membrane.H264.Parser do

def_input_pad :input,
flow_control: :auto,
accepted_format: any_of(%RemoteStream{type: :bytestream}, H264)
accepted_format: any_of(RemoteStream, H264)

def_output_pad :output,
flow_control: :auto,
Expand Down Expand Up @@ -211,7 +211,7 @@ defmodule Membrane.H264.Parser do
def parse_raw_input_stream_structure(stream_format) do
{alignment, input_raw_stream_structure} =
case stream_format do
%RemoteStream{type: :bytestream} ->
%RemoteStream{} ->
{:bytestream, :annexb}

%H264{alignment: alignment, stream_structure: stream_structure} ->
Expand Down
6 changes: 3 additions & 3 deletions lib/membrane_h264_plugin/h265_parser.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ defmodule Membrane.H265.Parser do
* `:au_aligned` - each input buffer contains a single access unit's payload
The parser's mode is set automatically, based on the input stream format received by that element:
* Receiving `%Membrane.RemoteStream{type: :bytestream}` results in the parser mode being set to `:bytestream`
* Receiving `Membrane.RemoteStream` results in the parser mode being set to `:bytestream`
* Receiving `%Membrane.H265{alignment: :nalu}` results in the parser mode being set to `:nalu_aligned`.
* Receiving `%Membrane.H265{alignment: :au}` results in the parser mode being set to `:au_aligned`.
Expand All @@ -43,7 +43,7 @@ defmodule Membrane.H265.Parser do

def_input_pad :input,
flow_control: :auto,
accepted_format: any_of(%RemoteStream{type: :bytestream}, H265)
accepted_format: any_of(RemoteStream, H265)

def_output_pad :output,
flow_control: :auto,
Expand Down Expand Up @@ -215,7 +215,7 @@ defmodule Membrane.H265.Parser do
def parse_raw_input_stream_structure(stream_format) do
{alignment, input_raw_stream_structure} =
case stream_format do
%RemoteStream{type: :bytestream} ->
%RemoteStream{} ->
{:bytestream, :annexb}

%H265{alignment: alignment, stream_structure: stream_structure} ->
Expand Down
4 changes: 2 additions & 2 deletions test/support/test_source.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defmodule Membrane.H26x.Support.TestSource do
flow_control: :push,
accepted_format:
any_of(
%Membrane.RemoteStream{type: :bytestream},
%Membrane.RemoteStream{type: :packetized},
%Membrane.H264{alignment: alignment} when alignment in [:au, :nalu],
%Membrane.H265{alignment: alignment} when alignment in [:au, :nalu]
)
Expand All @@ -36,7 +36,7 @@ defmodule Membrane.H26x.Support.TestSource do
stream_format =
case {state.codec, state.mode} do
{_codec, :bytestream} ->
%Membrane.RemoteStream{type: :bytestream}
%Membrane.RemoteStream{type: :packetized}

{:H264, :nalu_aligned} ->
%Membrane.H264{alignment: :nalu, stream_structure: state.output_raw_stream_structure}
Expand Down

0 comments on commit a43f00e

Please sign in to comment.