mirror of
https://github.com/HumanAIGC-Engineering/gradio-webrtc.git
synced 2026-02-05 18:09:23 +08:00
Sorts
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import fractions
|
import fractions
|
||||||
|
import logging
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
import av
|
import av
|
||||||
import logging
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import threading
|
|||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
from typing import TYPE_CHECKING, Any, Literal, Generator, Sequence, cast
|
from typing import TYPE_CHECKING, Any, Generator, Literal, Sequence, cast
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from aiortc import (
|
from aiortc import (
|
||||||
@@ -17,7 +17,7 @@ from aiortc import (
|
|||||||
RTCSessionDescription,
|
RTCSessionDescription,
|
||||||
VideoStreamTrack,
|
VideoStreamTrack,
|
||||||
)
|
)
|
||||||
from aiortc.contrib.media import AudioFrame, MediaRelay, VideoFrame # type: ignore
|
from aiortc.contrib.media import MediaRelay, VideoFrame # type: ignore
|
||||||
from aiortc.mediastreams import MediaStreamError
|
from aiortc.mediastreams import MediaStreamError
|
||||||
from gradio import wasm_utils
|
from gradio import wasm_utils
|
||||||
from gradio.components.base import Component, server
|
from gradio.components.base import Component, server
|
||||||
@@ -477,7 +477,7 @@ class WebRTC(Component):
|
|||||||
cb = ServerToClientVideo(cast(Callable, self.event_handler))
|
cb = ServerToClientVideo(cast(Callable, self.event_handler))
|
||||||
elif self.modality == "audio":
|
elif self.modality == "audio":
|
||||||
cb = ServerToClientAudio(cast(Callable, self.event_handler))
|
cb = ServerToClientAudio(cast(Callable, self.event_handler))
|
||||||
|
|
||||||
logger.debug("Adding track to peer connection", cb)
|
logger.debug("Adding track to peer connection", cb)
|
||||||
pc.addTrack(cb)
|
pc.addTrack(cb)
|
||||||
self.connections[body["webrtc_id"]] = cb
|
self.connections[body["webrtc_id"]] = cb
|
||||||
|
|||||||
Reference in New Issue
Block a user