Starting refactor of transports into their own directory
This commit is contained in:
@@ -72,7 +72,7 @@ class VADState(Enum):
|
||||
STOPPING = 4
|
||||
|
||||
|
||||
class BaseTransportService:
|
||||
class ThreadedTransport:
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@@ -24,10 +24,10 @@ from daily import (
|
||||
VirtualSpeakerDevice,
|
||||
)
|
||||
|
||||
from dailyai.services.base_transport_service import BaseTransportService
|
||||
from dailyai.transports.base_transport import ThreadedTransport
|
||||
|
||||
|
||||
class DailyTransportService(BaseTransportService, EventHandler):
|
||||
class DailyTransport(ThreadedTransport, EventHandler):
|
||||
_daily_initialized = False
|
||||
_lock = threading.Lock()
|
||||
|
||||
@@ -140,10 +140,10 @@ class DailyTransportService(BaseTransportService, EventHandler):
|
||||
|
||||
def _prerun(self):
|
||||
# Only initialize Daily once
|
||||
if not DailyTransportService._daily_initialized:
|
||||
with DailyTransportService._lock:
|
||||
if not DailyTransport._daily_initialized:
|
||||
with DailyTransport._lock:
|
||||
Daily.init()
|
||||
DailyTransportService._daily_initialized = True
|
||||
DailyTransport._daily_initialized = True
|
||||
self.client = CallClient(event_handler=self)
|
||||
|
||||
if self._mic_enabled:
|
||||
@@ -3,10 +3,10 @@ import numpy as np
|
||||
import tkinter as tk
|
||||
import pyaudio
|
||||
|
||||
from dailyai.services.base_transport_service import BaseTransportService
|
||||
from dailyai.transports.base_transport import ThreadedTransport
|
||||
|
||||
|
||||
class LocalTransportService(BaseTransportService):
|
||||
class LocalTransport(ThreadedTransport):
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self._sample_width = kwargs.get("sample_width") or 2
|
||||
@@ -7,7 +7,7 @@ from dailyai.pipeline.frame_processor import FrameProcessor
|
||||
from dailyai.pipeline.frames import AudioFrame, ControlFrame, EndFrame, Frame, TTSEndFrame, TTSStartFrame, TextFrame
|
||||
from dailyai.pipeline.pipeline import Pipeline
|
||||
from dailyai.serializers.protobuf_serializer import ProtobufFrameSerializer
|
||||
from dailyai.services.base_transport_service import BaseTransportService
|
||||
from dailyai.transports.base_transport import ThreadedTransport
|
||||
|
||||
|
||||
class WebSocketFrameProcessor(FrameProcessor):
|
||||
@@ -45,7 +45,7 @@ class WebSocketFrameProcessor(FrameProcessor):
|
||||
yield frame
|
||||
|
||||
|
||||
class WebsocketTransport(BaseTransportService):
|
||||
class WebsocketTransport(ThreadedTransport):
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self._sample_width = kwargs.get("sample_width", 2)
|
||||
Reference in New Issue
Block a user