From 7dd665cea1415296cf05cbabe7dca25e20f3224d Mon Sep 17 00:00:00 2001 From: TonyChyi Date: Tue, 18 Oct 2022 20:26:36 +0800 Subject: [PATCH] update --- TODO | 5 ++++- drivers/video/ppm.go | 14 -------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/TODO b/TODO index 8a47b5b..152747b 100644 --- a/TODO +++ b/TODO @@ -15,4 +15,7 @@ 1. 视频设备延迟过高 # 2022-10-11 -1. 解决视频设备延迟->丢帧机制?或者使用tmpfs->RGB到YUV时,双for循环慢,平均在30-50ms \ No newline at end of file +1. 解决视频设备延迟->丢帧机制?或者使用tmpfs->RGB到YUV时,双for循环慢,平均在30-50ms + +# 2022-10-18 +1. 视频稳定在15ms左右,但大分辨率仍然慢 diff --git a/drivers/video/ppm.go b/drivers/video/ppm.go index 7cf666b..da6ca4d 100644 --- a/drivers/video/ppm.go +++ b/drivers/video/ppm.go @@ -58,19 +58,6 @@ func (v *PPMStreamDriver) Properties() []prop.Media { func (v *PPMStreamDriver) VideoRecord(p prop.Media) (video.Reader, error) { logrus.Debug(p) - /*canvas := image.NewYCbCr( - image.Rect(0, 0, p.Width, p.Height), - image.YCbCrSubsampleRatio420, - ) - - Y, Cb, Cr := color.RGBToYCbCr(0, 0, 0) - for y := 0; y < canvas.Rect.Dy(); y++ { - for x := 0; x < canvas.Rect.Dx(); x++ { - canvas.Y[canvas.YOffset(x, y)] = Y - canvas.Cb[canvas.COffset(x, y)] = Cb - canvas.Cr[canvas.COffset(x, y)] = Cr - } - }*/ canvas := image.NewRGBA(image.Rect(0, 0, p.Width, p.Height)) var ( @@ -107,7 +94,6 @@ func (v *PPMStreamDriver) VideoRecord(p prop.Media) (video.Reader, error) { draw.Draw(canvas, image.Rect( offsetX, offsetY, offsetX+img.Bounds().Dx(), offsetY+img.Bounds().Dy(), ), img, img.Bounds().Min, draw.Over) - case <-time.After(time.Second / time.Duration(p.FrameRate)): default: } return canvas, func() {}, nil