Skip to content

Conversation

@eliteprox
Copy link
Collaborator

@eliteprox eliteprox commented Jul 23, 2025

This pull request enhances the pytrickle library by adding support for processing audio frames alongside video frames and improving error handling in asynchronous loops. The key changes include extending type annotations, updating frame processing logic, and introducing new methods for handling audio frames with corrected timestamps.

Audio frame support:

  • pytrickle/client.py:

    • Updated type annotations for frame_processor and process_frame to handle both VideoFrame and AudioFrame types, as well as their corresponding outputs (VideoOutput and AudioOutput). [1] [2] [3]
    • Added logic to process AudioFrame objects in _ingress_loop and send processed audio frames to the egress loop.
  • pytrickle/frames.py:

    • Introduced AudioFrame._from_existing_with_timestamp to create a new AudioFrame with a corrected timestamp.
    • Added AudioOutput.with_monotonic_timestamps to generate AudioOutput with monotonic timestamps for individual frames.

Error handling improvements:

  • pytrickle/client.py:
    • Enhanced the start method to ignore asyncio.CancelledError exceptions while logging other errors in asynchronous loops.

Code simplification:

  • pytrickle/protocol.py:
    • Removed redundant handling of AudioFrame in dequeue_frame, ensuring all frames are sent to the frame processor for consistency.

These changes improve the library's flexibility for handling both video and audio data while ensuring robust error handling and cleaner code.

Copy link
Contributor

@ad-astra-video ad-astra-video left a comment

Choose a reason for hiding this comment

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

LGTM

@eliteprox eliteprox merged commit 44a1f95 into main Aug 4, 2025
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