parallel_pipeline: fix system frames again
This commit is contained in:
@@ -27,11 +27,8 @@ class Source(FrameProcessor):
|
|||||||
|
|
||||||
match direction:
|
match direction:
|
||||||
case FrameDirection.UPSTREAM:
|
case FrameDirection.UPSTREAM:
|
||||||
# We don't want to queue system frames as they would be
|
# SystemFrames are pushed directly from ParallelPipeline.
|
||||||
# processed by a separate task.
|
if not isinstance(frame, SystemFrame):
|
||||||
if isinstance(frame, SystemFrame):
|
|
||||||
await self.push_frame(frame, direction)
|
|
||||||
else:
|
|
||||||
await self._up_queue.put(frame)
|
await self._up_queue.put(frame)
|
||||||
case FrameDirection.DOWNSTREAM:
|
case FrameDirection.DOWNSTREAM:
|
||||||
await self.push_frame(frame, direction)
|
await self.push_frame(frame, direction)
|
||||||
@@ -49,11 +46,8 @@ class Sink(FrameProcessor):
|
|||||||
case FrameDirection.UPSTREAM:
|
case FrameDirection.UPSTREAM:
|
||||||
await self.push_frame(frame, direction)
|
await self.push_frame(frame, direction)
|
||||||
case FrameDirection.DOWNSTREAM:
|
case FrameDirection.DOWNSTREAM:
|
||||||
# We don't want to queue system frames as they would be
|
# SystemFrames are pushed directly from ParallelPipeline.
|
||||||
# processed by a separate task.
|
if not isinstance(frame, SystemFrame):
|
||||||
if isinstance(frame, SystemFrame):
|
|
||||||
await self.push_frame(frame, direction)
|
|
||||||
else:
|
|
||||||
await self._down_queue.put(frame)
|
await self._down_queue.put(frame)
|
||||||
|
|
||||||
|
|
||||||
@@ -123,11 +117,13 @@ class ParallelPipeline(BasePipeline):
|
|||||||
await asyncio.gather(*[s.queue_frame(frame, direction) for s in self._sinks])
|
await asyncio.gather(*[s.queue_frame(frame, direction) for s in self._sinks])
|
||||||
elif direction == FrameDirection.DOWNSTREAM:
|
elif direction == FrameDirection.DOWNSTREAM:
|
||||||
# If we get a downstream frame we process it in each source.
|
# If we get a downstream frame we process it in each source.
|
||||||
# TODO(aleix): We are creating task for each frame. For real-time
|
|
||||||
# video/audio this might be too slow. We should use an already
|
|
||||||
# created task instead.
|
|
||||||
await asyncio.gather(*[s.queue_frame(frame, direction) for s in self._sources])
|
await asyncio.gather(*[s.queue_frame(frame, direction) for s in self._sources])
|
||||||
|
|
||||||
|
# If we have a SystemFrame we will push it from this task. Note that the
|
||||||
|
# connected sinks and sources ignore SystemFrames.
|
||||||
|
if isinstance(frame, SystemFrame):
|
||||||
|
await self.push_frame(frame, direction)
|
||||||
|
|
||||||
# If we get an EndFrame we stop our queue processing tasks and wait on
|
# If we get an EndFrame we stop our queue processing tasks and wait on
|
||||||
# all the pipelines to finish.
|
# all the pipelines to finish.
|
||||||
if isinstance(frame, (CancelFrame, EndFrame)):
|
if isinstance(frame, (CancelFrame, EndFrame)):
|
||||||
|
|||||||
Reference in New Issue
Block a user