processors(gstreamer): add clock_sync property
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
|
||||
import asyncio
|
||||
import aiohttp
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
from pipecat.pipeline.pipeline import Pipeline
|
||||
@@ -43,12 +42,11 @@ async def main():
|
||||
)
|
||||
|
||||
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(
|
||||
video_width=1280,
|
||||
video_height=720,
|
||||
)
|
||||
)
|
||||
clock_sync=False))
|
||||
|
||||
pipeline = Pipeline([
|
||||
gst, # GStreamer file source
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import asyncio
|
||||
|
||||
from openai import BaseModel
|
||||
from pydantic import BaseModel
|
||||
|
||||
from pipecat.frames.frames import (
|
||||
AudioRawFrame,
|
||||
@@ -37,6 +37,7 @@ class GStreamerPipelineSource(FrameProcessor):
|
||||
video_height: int = 720
|
||||
audio_sample_rate: int = 16000
|
||||
audio_channels: int = 1
|
||||
clock_sync: bool = True
|
||||
|
||||
def __init__(self, *, pipeline: str, out_params: OutputParams = OutputParams(), **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
@@ -156,7 +157,7 @@ class GStreamerPipelineSource(FrameProcessor):
|
||||
audiocapsfilter.set_property("caps", audiocaps)
|
||||
appsink_audio = Gst.ElementFactory.make("appsink", None)
|
||||
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)
|
||||
|
||||
self._player.add(queue_audio)
|
||||
@@ -189,7 +190,7 @@ class GStreamerPipelineSource(FrameProcessor):
|
||||
|
||||
appsink_video = Gst.ElementFactory.make("appsink", None)
|
||||
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)
|
||||
|
||||
self._player.add(queue_video)
|
||||
|
||||
Reference in New Issue
Block a user