processors(gstreamer): add clock_sync property
This commit is contained in:
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import argparse
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from pipecat.pipeline.pipeline import Pipeline
|
from pipecat.pipeline.pipeline import Pipeline
|
||||||
@@ -43,12 +42,11 @@ async def main():
|
|||||||
)
|
)
|
||||||
|
|
||||||
gst = GStreamerPipelineSource(
|
gst = GStreamerPipelineSource(
|
||||||
pipeline="videotestsrc ! capsfilter caps=\"video/x-raw,width=1280,height=720\"",
|
pipeline="videotestsrc ! capsfilter caps=\"video/x-raw,width=1280,height=720,framerate=30/1\"",
|
||||||
out_params=GStreamerPipelineSource.OutputParams(
|
out_params=GStreamerPipelineSource.OutputParams(
|
||||||
video_width=1280,
|
video_width=1280,
|
||||||
video_height=720,
|
video_height=720,
|
||||||
)
|
clock_sync=False))
|
||||||
)
|
|
||||||
|
|
||||||
pipeline = Pipeline([
|
pipeline = Pipeline([
|
||||||
gst, # GStreamer file source
|
gst, # GStreamer file source
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from openai import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from pipecat.frames.frames import (
|
from pipecat.frames.frames import (
|
||||||
AudioRawFrame,
|
AudioRawFrame,
|
||||||
@@ -37,6 +37,7 @@ class GStreamerPipelineSource(FrameProcessor):
|
|||||||
video_height: int = 720
|
video_height: int = 720
|
||||||
audio_sample_rate: int = 16000
|
audio_sample_rate: int = 16000
|
||||||
audio_channels: int = 1
|
audio_channels: int = 1
|
||||||
|
clock_sync: bool = True
|
||||||
|
|
||||||
def __init__(self, *, pipeline: str, out_params: OutputParams = OutputParams(), **kwargs):
|
def __init__(self, *, pipeline: str, out_params: OutputParams = OutputParams(), **kwargs):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
@@ -156,7 +157,7 @@ class GStreamerPipelineSource(FrameProcessor):
|
|||||||
audiocapsfilter.set_property("caps", audiocaps)
|
audiocapsfilter.set_property("caps", audiocaps)
|
||||||
appsink_audio = Gst.ElementFactory.make("appsink", None)
|
appsink_audio = Gst.ElementFactory.make("appsink", None)
|
||||||
appsink_audio.set_property("emit-signals", True)
|
appsink_audio.set_property("emit-signals", True)
|
||||||
appsink_audio.set_property("sync", False)
|
appsink_audio.set_property("sync", self._out_params.clock_sync)
|
||||||
appsink_audio.connect("new-sample", self._appsink_audio_new_sample)
|
appsink_audio.connect("new-sample", self._appsink_audio_new_sample)
|
||||||
|
|
||||||
self._player.add(queue_audio)
|
self._player.add(queue_audio)
|
||||||
@@ -189,7 +190,7 @@ class GStreamerPipelineSource(FrameProcessor):
|
|||||||
|
|
||||||
appsink_video = Gst.ElementFactory.make("appsink", None)
|
appsink_video = Gst.ElementFactory.make("appsink", None)
|
||||||
appsink_video.set_property("emit-signals", True)
|
appsink_video.set_property("emit-signals", True)
|
||||||
appsink_video.set_property("sync", False)
|
appsink_video.set_property("sync", self._out_params.clock_sync)
|
||||||
appsink_video.connect("new-sample", self._appsink_video_new_sample)
|
appsink_video.connect("new-sample", self._appsink_video_new_sample)
|
||||||
|
|
||||||
self._player.add(queue_video)
|
self._player.add(queue_video)
|
||||||
|
|||||||
Reference in New Issue
Block a user