Skip to content

Conversation

@varsill
Copy link
Collaborator

@varsill varsill commented Oct 16, 2025

@varsill varsill marked this pull request as draft October 16, 2025 09:26
@varsill varsill marked this pull request as ready for review November 5, 2025 15:20
@varsill varsill requested a review from mat-hek November 5, 2025 15:37
Comment on lines +45 to +47
{:mpeg_ts,
github: "membraneframework-labs/kim_mpeg_ts",
branch: "varsill/fix_pes_optional_header_resolving"},
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We either need to wait for backport of my bugfix on mpeg_ts v2 or update our dependency to mpeg_ts v3

Comment on lines 119 to 121
nil -> {nil, demuxer}
{[], updated_demuxer} -> {nil, updated_demuxer}
false -> {nil, demuxer}
Copy link
Member

Choose a reason for hiding this comment

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

This can easily get messed up so that a wrong clause matches. Either use withl or reshape it to be less ambiguous

Comment on lines 126 to 129
with {pos, len} <- :binary.match(payload, "TDEN"),
trailing_bytes <- :binary.part(payload, pos + len, byte_size(payload) - (pos + len)),
<<size::integer-size(4)-unit(8), _flags::16, rest::binary>> <- trailing_bytes,
<<_3, text::binary-size(size - 2), 0, _rest::binary>> <- rest do
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
with {pos, len} <- :binary.match(payload, "TDEN"),
trailing_bytes <- :binary.part(payload, pos + len, byte_size(payload) - (pos + len)),
<<size::integer-size(4)-unit(8), _flags::16, rest::binary>> <- trailing_bytes,
<<_3, text::binary-size(size - 2), 0, _rest::binary>> <- rest do
with {pos, _len} <- :binary.match(payload, "TDEN"),
<<_skip::binary-size(pos), "TDEN", tden::binary>> <- payload,
<<size::integer-size(4)-unit(8), _flags::16, _3, text::binary-size(size - 2), 0, _rest::binary>> <- tden do

btw, what is _3?

Copy link
Collaborator Author

@varsill varsill Nov 7, 2025

Choose a reason for hiding this comment

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

It's a flag indicating encoding of the timestamps string (3 stands for UTF-8)
I think it's good enough to support just UTF-8 encoded strings (so I will make it match for exact value of 3 in this binary) - WDYT?

Comment on lines 155 to 158
&(&1.metadata.tden_tag != nil and
&1.media_type ==
:video)
)
Copy link
Member

Choose a reason for hiding this comment

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

looks weird, if can't be fixed let's change to fn

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

perhaps it's because of formatting? These are just two conditions merged with AND:
&(&1.metadata.tden_tag != nil and &1.media_type == :video)

Copy link
Member

Choose a reason for hiding this comment

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

I only meant the formatting is weird

@varsill varsill requested a review from mat-hek November 13, 2025 14:41
defp parse_tden_tag(payload) do
with {pos, _len} <- :binary.match(payload, "TDEN"),
<<_skip::binary-size(pos), "TDEN", tden::binary>> <- payload,
<<size::integer-size(4)-unit(8), _flags::16, _3, text::binary-size(size - 2), 0,
Copy link
Member

Choose a reason for hiding this comment

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

I think we agreed we need to
match on '3'?

@varsill varsill requested review from mat-hek November 14, 2025 09:53
@varsill varsill deleted the branch master November 17, 2025 10:02
@varsill varsill closed this Nov 17, 2025
@varsill varsill reopened this Nov 17, 2025
<<size::integer-size(4)-unit(8), _flags::16, _3, text::binary-size(size - 2), 0,
_rest::binary>> <- tden do
<<size::integer-size(4)-unit(8), _flags::16, ^encoding::8, text::binary-size(size - 2),
0::8, _rest::binary>> <- tden do
Copy link
Member

Choose a reason for hiding this comment

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

NIT: 8 bits is the default for an integer, so 0::8 can become 0

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, but as discussed - I think it's easier for me to read it with these ::8 as they are surrounded by ::16 etc. :D

@varsill varsill changed the base branch from varsill/ultra_low_latency to master November 17, 2025 10:04
@varsill varsill merged commit da05e20 into master Nov 17, 2025
3 checks passed
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