From 510420d42d53df2d222e3e0ef7e7217235b741cc Mon Sep 17 00:00:00 2001 From: Rob Watson Date: Wed, 18 Apr 2018 21:48:09 +0200 Subject: [PATCH] Cleanup --- lib/mpeg_audio_frame_parser/impl.ex | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/mpeg_audio_frame_parser/impl.ex b/lib/mpeg_audio_frame_parser/impl.ex index 73f29e3..7fcdd5a 100644 --- a/lib/mpeg_audio_frame_parser/impl.ex +++ b/lib/mpeg_audio_frame_parser/impl.ex @@ -50,8 +50,7 @@ defmodule MPEGAudioFrameParser.Impl do # Not synced, found a sync word. Create a new frame struct: defp process_bytes(%{current_frame: nil} = state, <<@sync_word::size(11), header::size(21), rest::bits>>) do - header = <<@sync_word::size(11), header::size(21)>> - frame = Frame.from_header(header) + frame = <<@sync_word::size(11), header::size(21)>> |> Frame.from_header process_bytes(%{state | current_frame: frame}, rest) end @@ -63,8 +62,7 @@ defmodule MPEGAudioFrameParser.Impl do # Synced, but with an invalid header. Discard a byte: defp process_bytes(%{current_frame: %Frame{valid: false}} = state, packet) do - data = <> - <<_byte, rest::bits>> = data + <<_byte, rest::bits>> = <> process_bytes(%{state | current_frame: nil}, rest) end