StartFrame should be the first frame every processor receives

Fixes #427
This commit is contained in:
Aleix Conchillo Flaqué
2024-08-29 22:43:01 -07:00
parent 05f0492a8d
commit 37e2388758
4 changed files with 10 additions and 4 deletions

View File

@@ -356,8 +356,10 @@ class RTVIProcessor(FrameProcessor):
await self.push_frame(frame, direction)
# Control frames
elif isinstance(frame, StartFrame):
await self._start(frame)
# Push StartFrame before start(), because we want StartFrame to be
# processed by every processor before any other frame is processed.
await self.push_frame(frame, direction)
await self._start(frame)
elif isinstance(frame, EndFrame):
# Push EndFrame before stop(), because stop() waits on the task to
# finish and the task finishes when EndFrame is processed.

View File

@@ -78,8 +78,10 @@ class GStreamerPipelineSource(FrameProcessor):
await self.push_frame(frame, direction)
# Control frames
elif isinstance(frame, StartFrame):
await self._start(frame)
# Push StartFrame before start(), because we want StartFrame to be
# processed by every processor before any other frame is processed.
await self._internal_push_frame(frame, direction)
await self._start(frame)
elif isinstance(frame, EndFrame):
# Push EndFrame before stop(), because stop() waits on the task to
# finish and the task finishes when EndFrame is processed.

View File

@@ -96,8 +96,10 @@ class BaseInputTransport(FrameProcessor):
await self.push_frame(frame, direction)
# Control frames
elif isinstance(frame, StartFrame):
await self.start(frame)
# Push StartFrame before start(), because we want StartFrame to be
# processed by every processor before any other frame is processed.
await self._internal_push_frame(frame, direction)
await self.start(frame)
elif isinstance(frame, EndFrame):
# Push EndFrame before stop(), because stop() waits on the task to
# finish and the task finishes when EndFrame is processed.

View File

@@ -134,8 +134,8 @@ class BaseOutputTransport(FrameProcessor):
# queue.
#
if isinstance(frame, CancelFrame):
await self.push_frame(frame, direction)
await self.cancel(frame)
await self.push_frame(frame, direction)
elif isinstance(frame, StartInterruptionFrame) or isinstance(frame, StopInterruptionFrame):
await self.push_frame(frame, direction)
await self._handle_interruptions(frame)