diff --git a/lib/mpeg_audio_frame_parser/frame.ex b/lib/mpeg_audio_frame_parser/frame.ex index 06476a2..b4f2888 100644 --- a/lib/mpeg_audio_frame_parser/frame.ex +++ b/lib/mpeg_audio_frame_parser/frame.ex @@ -200,8 +200,7 @@ defmodule MPEGAudioFrameParser.Frame do end end - defp parse_padding(<<@sync_word::size(11), _::size(11), 0b0::size(1), _::bits>>), do: 0 - defp parse_padding(<<@sync_word::size(11), _::size(11), 0b1::size(1), _::bits>>), do: 1 + defp parse_padding(<<@sync_word::size(11), _::size(11), padding_bit::size(1), _::bits>>), do: padding_bit defp samples_per_frame(%Frame{layer: :layer1}), do: 384 defp samples_per_frame(%Frame{layer: :layer2}), do: 1152 diff --git a/lib/mpeg_audio_frame_parser/impl.ex b/lib/mpeg_audio_frame_parser/impl.ex index 7fcdd5a..132d370 100644 --- a/lib/mpeg_audio_frame_parser/impl.ex +++ b/lib/mpeg_audio_frame_parser/impl.ex @@ -67,7 +67,7 @@ defmodule MPEGAudioFrameParser.Impl do end # Synced, current frame not complete and we have bytes available. Add bytes to frame: - defp process_bytes(%{current_frame: %Frame{complete: false}} = state, packet) do + defp process_bytes(state, packet) do {:ok, frame, rest} = Frame.add_bytes(state.current_frame, packet) process_bytes(%{state | current_frame: frame}, rest) end