RTC提交
This commit is contained in:
@ -2,6 +2,7 @@ import asyncio
|
|||||||
import aiohttp
|
import aiohttp
|
||||||
from aiortc import RTCPeerConnection, RTCSessionDescription, RTCConfiguration
|
from aiortc import RTCPeerConnection, RTCSessionDescription, RTCConfiguration
|
||||||
from aiortc.mediastreams import MediaStreamTrack
|
from aiortc.mediastreams import MediaStreamTrack
|
||||||
|
from ocr.ocr_violation_detector import detect
|
||||||
|
|
||||||
|
|
||||||
class VideoTrack(MediaStreamTrack):
|
class VideoTrack(MediaStreamTrack):
|
||||||
@ -88,6 +89,10 @@ async def frame_consumer(frame_queue):
|
|||||||
while True:
|
while True:
|
||||||
# 从队列中获取帧(队列为空时会阻塞等待新帧)
|
# 从队列中获取帧(队列为空时会阻塞等待新帧)
|
||||||
current_frame = await frame_queue.get()
|
current_frame = await frame_queue.get()
|
||||||
|
|
||||||
|
# 检测
|
||||||
|
detect(current_frame)
|
||||||
|
|
||||||
print(f"从队列获取到帧、尺寸: {current_frame.shape}、进行处理")
|
print(f"从队列获取到帧、尺寸: {current_frame.shape}、进行处理")
|
||||||
|
|
||||||
# 标记任务完成
|
# 标记任务完成
|
||||||
|
Reference in New Issue
Block a user