Renaming from broadcasted_sibling_id to broadcast_sibling_id
This commit is contained in:
@@ -1 +1 @@
|
|||||||
- Added `broadcasted_sibling_id` field to the base `Frame` class. This field is automatically set by `broadcast_frame()` and `broadcast_frame_instance()` to the ID of the paired frame pushed in the opposite direction, allowing receivers to identify broadcast pairs.
|
- Added `broadcast_sibling_id` field to the base `Frame` class. This field is automatically set by `broadcast_frame()` and `broadcast_frame_instance()` to the ID of the paired frame pushed in the opposite direction, allowing receivers to identify broadcast pairs.
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ class Frame:
|
|||||||
id: Unique identifier for the frame instance.
|
id: Unique identifier for the frame instance.
|
||||||
name: Human-readable name combining class name and instance count.
|
name: Human-readable name combining class name and instance count.
|
||||||
pts: Presentation timestamp in nanoseconds.
|
pts: Presentation timestamp in nanoseconds.
|
||||||
broadcasted_sibling_id: ID of the paired frame when this frame was
|
broadcast_sibling_id: ID of the paired frame when this frame was
|
||||||
broadcast in both directions. Set automatically by
|
broadcast in both directions. Set automatically by
|
||||||
``broadcast_frame()`` and ``broadcast_frame_instance()``.
|
``broadcast_frame()`` and ``broadcast_frame_instance()``.
|
||||||
metadata: Dictionary for arbitrary frame metadata.
|
metadata: Dictionary for arbitrary frame metadata.
|
||||||
@@ -134,7 +134,7 @@ class Frame:
|
|||||||
id: int = field(init=False)
|
id: int = field(init=False)
|
||||||
name: str = field(init=False)
|
name: str = field(init=False)
|
||||||
pts: Optional[int] = field(init=False)
|
pts: Optional[int] = field(init=False)
|
||||||
broadcasted_sibling_id: Optional[int] = field(init=False)
|
broadcast_sibling_id: Optional[int] = field(init=False)
|
||||||
metadata: Dict[str, Any] = field(init=False)
|
metadata: Dict[str, Any] = field(init=False)
|
||||||
transport_source: Optional[str] = field(init=False)
|
transport_source: Optional[str] = field(init=False)
|
||||||
transport_destination: Optional[str] = field(init=False)
|
transport_destination: Optional[str] = field(init=False)
|
||||||
@@ -143,7 +143,7 @@ class Frame:
|
|||||||
self.id: int = obj_id()
|
self.id: int = obj_id()
|
||||||
self.name: str = f"{self.__class__.__name__}#{obj_count(self)}"
|
self.name: str = f"{self.__class__.__name__}#{obj_count(self)}"
|
||||||
self.pts: Optional[int] = None
|
self.pts: Optional[int] = None
|
||||||
self.broadcasted_sibling_id: Optional[int] = None
|
self.broadcast_sibling_id: Optional[int] = None
|
||||||
self.metadata: Dict[str, Any] = {}
|
self.metadata: Dict[str, Any] = {}
|
||||||
self.transport_source: Optional[str] = None
|
self.transport_source: Optional[str] = None
|
||||||
self.transport_destination: Optional[str] = None
|
self.transport_destination: Optional[str] = None
|
||||||
|
|||||||
@@ -789,8 +789,8 @@ class FrameProcessor(BaseObject):
|
|||||||
"""
|
"""
|
||||||
downstream_frame = frame_cls(**kwargs)
|
downstream_frame = frame_cls(**kwargs)
|
||||||
upstream_frame = frame_cls(**kwargs)
|
upstream_frame = frame_cls(**kwargs)
|
||||||
downstream_frame.broadcasted_sibling_id = upstream_frame.id
|
downstream_frame.broadcast_sibling_id = upstream_frame.id
|
||||||
upstream_frame.broadcasted_sibling_id = downstream_frame.id
|
upstream_frame.broadcast_sibling_id = downstream_frame.id
|
||||||
await self.push_frame(downstream_frame)
|
await self.push_frame(downstream_frame)
|
||||||
await self.push_frame(upstream_frame, FrameDirection.UPSTREAM)
|
await self.push_frame(upstream_frame, FrameDirection.UPSTREAM)
|
||||||
|
|
||||||
@@ -824,8 +824,8 @@ class FrameProcessor(BaseObject):
|
|||||||
for k, v in extra_fields.items():
|
for k, v in extra_fields.items():
|
||||||
setattr(upstream_frame, k, v)
|
setattr(upstream_frame, k, v)
|
||||||
|
|
||||||
downstream_frame.broadcasted_sibling_id = upstream_frame.id
|
downstream_frame.broadcast_sibling_id = upstream_frame.id
|
||||||
upstream_frame.broadcasted_sibling_id = downstream_frame.id
|
upstream_frame.broadcast_sibling_id = downstream_frame.id
|
||||||
await self.push_frame(downstream_frame)
|
await self.push_frame(downstream_frame)
|
||||||
await self.push_frame(upstream_frame, FrameDirection.UPSTREAM)
|
await self.push_frame(upstream_frame, FrameDirection.UPSTREAM)
|
||||||
|
|
||||||
|
|||||||
@@ -1222,7 +1222,7 @@ class RTVIObserver(BaseObserver):
|
|||||||
|
|
||||||
# For broadcasted frames (pushed in both directions), only process
|
# For broadcasted frames (pushed in both directions), only process
|
||||||
# the downstream copy to avoid sending duplicate RTVI messages.
|
# the downstream copy to avoid sending duplicate RTVI messages.
|
||||||
if frame.broadcasted_sibling_id is not None and direction != FrameDirection.DOWNSTREAM:
|
if frame.broadcast_sibling_id is not None and direction != FrameDirection.DOWNSTREAM:
|
||||||
return
|
return
|
||||||
|
|
||||||
# If we have already seen this frame, let's skip it.
|
# If we have already seen this frame, let's skip it.
|
||||||
|
|||||||
@@ -615,8 +615,8 @@ class BaseOutputTransport(FrameProcessor):
|
|||||||
upstream_frame.transport_destination = self._destination
|
upstream_frame.transport_destination = self._destination
|
||||||
|
|
||||||
# Setting the siblings id
|
# Setting the siblings id
|
||||||
upstream_frame.broadcasted_sibling_id = downstream_frame.id
|
upstream_frame.broadcast_sibling_id = downstream_frame.id
|
||||||
downstream_frame.broadcasted_sibling_id = upstream_frame.id
|
downstream_frame.broadcast_sibling_id = upstream_frame.id
|
||||||
|
|
||||||
await self._transport.push_frame(downstream_frame)
|
await self._transport.push_frame(downstream_frame)
|
||||||
await self._transport.push_frame(upstream_frame, FrameDirection.UPSTREAM)
|
await self._transport.push_frame(upstream_frame, FrameDirection.UPSTREAM)
|
||||||
@@ -642,8 +642,8 @@ class BaseOutputTransport(FrameProcessor):
|
|||||||
upstream_frame.transport_destination = self._destination
|
upstream_frame.transport_destination = self._destination
|
||||||
|
|
||||||
# Setting the siblings id
|
# Setting the siblings id
|
||||||
upstream_frame.broadcasted_sibling_id = downstream_frame.id
|
upstream_frame.broadcast_sibling_id = downstream_frame.id
|
||||||
downstream_frame.broadcasted_sibling_id = upstream_frame.id
|
downstream_frame.broadcast_sibling_id = upstream_frame.id
|
||||||
|
|
||||||
await self._transport.push_frame(downstream_frame)
|
await self._transport.push_frame(downstream_frame)
|
||||||
await self._transport.push_frame(upstream_frame, FrameDirection.UPSTREAM)
|
await self._transport.push_frame(upstream_frame, FrameDirection.UPSTREAM)
|
||||||
|
|||||||
Reference in New Issue
Block a user