Feat/multicast - #1
Merged
Merged
Conversation
Collaborator
Author
|
good to me |
There was a problem hiding this comment.
Pull request overview
This PR refactors the video streaming app toward a UDP-multicast-first architecture by introducing a shared multicast stream manager on the server and adding a multicast-based state synchronization channel that drives client UI/playback behavior.
Changes:
- Added shared multicast configuration/constants and a state packet format for UDP multicast announcements.
- Introduced
MulticastStreamManagerto own the shared RTP multicast sender and official stream state/versioning. - Updated server/client control flow and UI to align with multicast delivery and server-driven state synchronization (plus documentation updates).
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| StatePacket.py | Adds JSON-based encode/decode helpers for multicast state announcements. |
| MulticastStreamManager.py | New shared manager for RTP multicast sending and state multicast announcements. |
| Config.py | Centralizes multicast groups/ports/TTL and default media file name. |
| ServerWorker.py | Delegates UDP media control to MulticastStreamManager and manages multicast client registration. |
| Server.py | Creates and injects a shared MulticastStreamManager into per-client workers. |
| ClientLauncher.py | Simplifies CLI args; uses DEFAULT_MEDIA_FILE and removes RTP port arg. |
| Client.py | Joins RTP/state multicast groups, listens for official state updates, and simplifies setup/play/pause around multicast. |
| README.md | Updates documentation and diagrams to reflect multicast-only media delivery and shared state control. |
| doc/multicast_design.md | Adds a checkpoint design doc describing current vs target multicast behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+63
to
67
| previousTransport = self.clientInfo.get('transport') | ||
| transport_line = request[2] | ||
| self.clientInfo['transport'] = 'UDP' | ||
| if 'TCP' in transport_line: | ||
| self.clientInfo['transport'] = 'TCP' |
Comment on lines
+588
to
+594
| try: | ||
| self.rtpSocket.bind(('', RTP_MULTICAST_PORT)) | ||
| mreq = socket.inet_aton(RTP_MULTICAST_GROUP) + socket.inet_aton('0.0.0.0') | ||
| self.rtpSocket.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq) | ||
| print(f"Joined RTP multicast group {RTP_MULTICAST_GROUP}:{RTP_MULTICAST_PORT}") | ||
| except Exception as e: | ||
| tkMessageBox.showwarning('Unable to Join Multicast', f'Unable to join RTP multicast group {RTP_MULTICAST_GROUP}:{RTP_MULTICAST_PORT}: {e}') |
|
|
||
| def listenStateMulticast(self): | ||
| """Receive official state multicast packets and apply them on the UI thread.""" | ||
| while not self.stateEvent.isSet(): |
| frameSize = len(data) | ||
| bytesSent = 0 | ||
|
|
||
| while bytesSent < frameSize and not self.stopEvent.isSet(): |
Comment on lines
+161
to
+168
| data = videoStream.nextFrame() | ||
| if not data: | ||
| with self.lock: | ||
| self.state = STOPPED | ||
| self.worker = None | ||
| self.stopEvent.set() | ||
| self._send_state_multicast(STOPPED) | ||
| break |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors the
Client.pyto support video streaming exclusively via UDP multicast, removes legacy TCP and quality selection code, and introduces a multicast-based state synchronization mechanism. The UI and client logic are updated to reflect these changes, ensuring that all clients join the same multicast group for both media and state updates. The code is also simplified to remove unnecessary options and methods related to TCP and quality selection.Multicast Streaming and State Synchronization:
Config.py. All TCP-related code and quality selection logic have been removed. The UI is updated to reflect this, and the setup dialog now only informs users about the multicast stream. (Client.py, removal oflistenRtpWithTCP,chooseQuality, and related UI; addition ofchooseMulticastStream,openRtpPort, and associated changes) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]State Multicast Listener and Synchronization:
startStateListener,listenStateMulticast,applyServerState,closeStateListener, and integration in constructor and teardown) [1] [2]UI/UX Simplification and Robustness:
setupMovie,pauseMovie,playMovie,startPlaybackPipeline, and related UI changes) [1] [2] [3] [4] [5] [6] [7]Code Cleanup:
listenRtpWithTCP,recv_all, radio button UI, and related logic) [1] [2]Configuration Centralization:
Config.py, centralizing configuration and making it easier to update deployment parameters. [1] [2]These changes modernize the client, ensuring all clients receive the same stream and state information in real time, while simplifying the user experience and internal logic.