FrameProcessor: copy kwargs when broadcasting frame

This commit is contained in:
Aleix Conchillo Flaqué
2026-01-21 18:05:15 -08:00
parent eacd2a4b71
commit ba0ddb1832

View File

@@ -781,14 +781,14 @@ class FrameProcessor(BaseObject):
frame_cls: The class of the frame to be broadcasted. frame_cls: The class of the frame to be broadcasted.
**kwargs: Keyword arguments to be passed to the frame's constructor. **kwargs: Keyword arguments to be passed to the frame's constructor.
""" """
await self.push_frame(frame_cls(**kwargs)) await self.push_frame(frame_cls(**deepcopy(kwargs)))
await self.push_frame(frame_cls(**kwargs), FrameDirection.UPSTREAM) await self.push_frame(frame_cls(**deepcopy(kwargs)), FrameDirection.UPSTREAM)
async def broadcast_frame_instance(self, frame: Frame): async def broadcast_frame_instance(self, frame: Frame):
"""Broadcasts a frame instance upstream and downstream. """Broadcasts a frame instance upstream and downstream.
This method extracts the class and init fields from the given frame This method creates two new frame instances copying all fields from the
instance and creates two new instances to push upstream and downstream. original frame except `id` and `name`, which get fresh values.
Args: Args:
frame: The frame instance to broadcast. frame: The frame instance to broadcast.