Skip to content

Conversation

@tonygallen
Copy link

There are 3 changes in this PR.

1. Bug Fix

  • Fixes a bug in the UDP decoder (udp_decoder.py) for the t32 format by correctly extracting the on field from the packed y+on value and initializes the offest variable.

2. Added UDP Unit Test

  • Added a test that transmits and receives randomly generated events on localhost for both UDP formats and validates the events, including wrapping for the 32-bit timestamp.

3. Refactor UDP packetization interface:

  • Replaces the payload_length parameter with events_per_packet in the UDP encoder (udp_encoder.py). It seems to me that payload_length was really the number events per packet , so the I renamed the argument and removed the divisibility check like assert payload_length % 8 == 0.
  • Changed the default value for new events_per_packet to 100 to be under the MTU for both formats. (Previous default value was above MacOS limit for UDP packet size 9216 bytes)
  • It is worth noting that I seem to get better performance when exceeding the MTU and fragment packets. So perhaps its better to increase the default value?
  • Another worthy note is that I occasionally run into UDP socket buffer overflow. Possible solution would be to drop packets when that happens.

Payload length was actually the number of events per packet. So, I have renamed the variable and removed the divisibility check.

Also, each format now has the same default number of events per packet.
The regularize filter uses typing.Optional[timestamp.TimeOrTimecode] for its start parameter, but this type wasn't handled in the filter parser. Added type annotation checks for TimeOrTimecode and Optional[TimeOrTimecode], mapping them to the existing parse_time and parse_optional_time functions respectively.
The view subparser for frame output was missing the --progress argument that other output subparsers have, causing a KeyError when accessing args["progress"]. Also changed the method call from to_viewer() to view() to match the actual API. The fix adds conditional progress argument handling (defaulting to show progress for finite streams, hidden for infinite streams) and properly removes the unused on_progress argument before calling view().
@tonygallen tonygallen changed the title UDP bug fix and minor interface refactor UDP bug fix and minor interface refactor, fix CLI filter and view command Dec 11, 2025
@tonygallen
Copy link
Author

tonygallen commented Dec 11, 2025

Added two more commits:

1. Fixes the CLI filter command as in this issue #29 (comment)

  • The regularize filter uses typing.Optional[timestamp.TimeOrTimecode] for its start parameter, but this type wasn't handled in the filter parser. Added type annotation checks for TimeOrTimecode and Optional[TimeOrTimecode], mapping them to the existing parse_time and parse_optional_time functions respectively.

2. Fix the CLI view command to work infinite streams

  • The view subparser for frame output was missing the --progress argument that other output subparsers have, causing a KeyError when accessing args["progress"]. Also changed the method call from to_viewer() to view() to match the actual API. The fix adds conditional progress argument handling (defaulting to show progress for finite streams, hidden for infinite streams) and properly removes the unused on_progress argument before calling view().

We should add some unit tests for the CLI.

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.

1 participant