diff --git a/changelog/3774.added.md b/changelog/3774.added.md index 8e442999c..e72599e60 100644 --- a/changelog/3774.added.md +++ b/changelog/3774.added.md @@ -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. diff --git a/src/pipecat/frames/frames.py b/src/pipecat/frames/frames.py index e6bc008ab..62c0d1352 100644 --- a/src/pipecat/frames/frames.py +++ b/src/pipecat/frames/frames.py @@ -123,7 +123,7 @@ class Frame: id: Unique identifier for the frame instance. name: Human-readable name combining class name and instance count. 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_frame()`` and ``broadcast_frame_instance()``. metadata: Dictionary for arbitrary frame metadata. @@ -134,7 +134,7 @@ class Frame: id: int = field(init=False) name: str = 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) transport_source: Optional[str] = field(init=False) transport_destination: Optional[str] = field(init=False) @@ -143,7 +143,7 @@ class Frame: self.id: int = obj_id() self.name: str = f"{self.__class__.__name__}#{obj_count(self)}" 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.transport_source: Optional[str] = None self.transport_destination: Optional[str] = None diff --git a/src/pipecat/processors/frame_processor.py b/src/pipecat/processors/frame_processor.py index 6bdd9ae1d..0d20214b2 100644 --- a/src/pipecat/processors/frame_processor.py +++ b/src/pipecat/processors/frame_processor.py @@ -789,8 +789,8 @@ class FrameProcessor(BaseObject): """ downstream_frame = frame_cls(**kwargs) upstream_frame = frame_cls(**kwargs) - downstream_frame.broadcasted_sibling_id = upstream_frame.id - upstream_frame.broadcasted_sibling_id = downstream_frame.id + downstream_frame.broadcast_sibling_id = upstream_frame.id + upstream_frame.broadcast_sibling_id = downstream_frame.id await self.push_frame(downstream_frame) await self.push_frame(upstream_frame, FrameDirection.UPSTREAM) @@ -824,8 +824,8 @@ class FrameProcessor(BaseObject): for k, v in extra_fields.items(): setattr(upstream_frame, k, v) - downstream_frame.broadcasted_sibling_id = upstream_frame.id - upstream_frame.broadcasted_sibling_id = downstream_frame.id + downstream_frame.broadcast_sibling_id = upstream_frame.id + upstream_frame.broadcast_sibling_id = downstream_frame.id await self.push_frame(downstream_frame) await self.push_frame(upstream_frame, FrameDirection.UPSTREAM) diff --git a/src/pipecat/processors/frameworks/rtvi.py b/src/pipecat/processors/frameworks/rtvi.py index 55be46452..a8b66ccdd 100644 --- a/src/pipecat/processors/frameworks/rtvi.py +++ b/src/pipecat/processors/frameworks/rtvi.py @@ -1222,7 +1222,7 @@ class RTVIObserver(BaseObserver): # For broadcasted frames (pushed in both directions), only process # 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 # If we have already seen this frame, let's skip it. diff --git a/src/pipecat/transports/base_output.py b/src/pipecat/transports/base_output.py index 4f072c0df..1a5083128 100644 --- a/src/pipecat/transports/base_output.py +++ b/src/pipecat/transports/base_output.py @@ -615,8 +615,8 @@ class BaseOutputTransport(FrameProcessor): upstream_frame.transport_destination = self._destination # Setting the siblings id - upstream_frame.broadcasted_sibling_id = downstream_frame.id - downstream_frame.broadcasted_sibling_id = upstream_frame.id + upstream_frame.broadcast_sibling_id = downstream_frame.id + downstream_frame.broadcast_sibling_id = upstream_frame.id await self._transport.push_frame(downstream_frame) await self._transport.push_frame(upstream_frame, FrameDirection.UPSTREAM) @@ -642,8 +642,8 @@ class BaseOutputTransport(FrameProcessor): upstream_frame.transport_destination = self._destination # Setting the siblings id - upstream_frame.broadcasted_sibling_id = downstream_frame.id - downstream_frame.broadcasted_sibling_id = upstream_frame.id + upstream_frame.broadcast_sibling_id = downstream_frame.id + downstream_frame.broadcast_sibling_id = upstream_frame.id await self._transport.push_frame(downstream_frame) await self._transport.push_frame(upstream_frame, FrameDirection.UPSTREAM)