Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't fail when unknown sample types are encountered #116

Merged
merged 6 commits into from
Aug 22, 2024

Conversation

varsill
Copy link
Contributor

@varsill varsill commented Jul 24, 2024

This PR:

  • allows for parsing samples with unknown type (like tcmd samples)
  • makes sure, that stsz entry list is read only when sample_size equals 0 (as defined in the specification)

@varsill varsill requested a review from mat-hek as a code owner July 24, 2024 13:03
@varsill varsill requested a review from FelonEkonom July 24, 2024 13:03
…s 0 (as the specification defines. Ignore unsupported sample types. Add tests checking if unsupported sample types are ignored
Comment on lines 654 to 657
|> Enum.filter(fn {_track_id, table} ->
table.sample_description == nil
end)
|> length()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -512,12 +519,14 @@ defmodule Membrane.MP4.Demuxer.ISOM do
defp sample_description_to_kind(%Membrane.H265{}), do: :video
defp sample_description_to_kind(%Membrane.AAC{}), do: :audio
defp sample_description_to_kind(%Membrane.Opus{}), do: :audio
defp sample_description_to_kind(_other), do: :unknown
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the new case used anywhere?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If not, let's remove it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's indeed not used, I will remove it

Comment on lines 435 to 436
|> Enum.reject(fn {_track_id, table} -> table.sample_description == nil end)
|> Enum.into(%{})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
|> Enum.reject(fn {_track_id, table} -> table.sample_description == nil end)
|> Enum.into(%{})
|> Map.reject(fn {_track_id, table} -> table.sample_description == nil end)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And let's extract it to a separate function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@varsill varsill requested a review from mat-hek July 31, 2024 12:34
lib/membrane_mp4/demuxer/isom.ex Outdated Show resolved Hide resolved
@varsill varsill merged commit 235566f into master Aug 22, 2024
3 checks passed
@varsill varsill deleted the drop_unknown_sample_types branch August 22, 2024 14:42
@varsill varsill restored the drop_unknown_sample_types branch August 22, 2024 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants