This commit is contained in:
TonyChyi 2022-10-18 20:26:36 +08:00
parent 3812babc58
commit 7dd665cea1
2 changed files with 4 additions and 15 deletions

3
TODO
View File

@ -16,3 +16,6 @@
# 2022-10-11 # 2022-10-11
1. 解决视频设备延迟->丢帧机制或者使用tmpfs->RGB到YUV时双for循环慢平均在30-50ms 1. 解决视频设备延迟->丢帧机制或者使用tmpfs->RGB到YUV时双for循环慢平均在30-50ms
# 2022-10-18
1. 视频稳定在15ms左右但大分辨率仍然慢

View File

@ -58,19 +58,6 @@ func (v *PPMStreamDriver) Properties() []prop.Media {
func (v *PPMStreamDriver) VideoRecord(p prop.Media) (video.Reader, error) { func (v *PPMStreamDriver) VideoRecord(p prop.Media) (video.Reader, error) {
logrus.Debug(p) 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)) canvas := image.NewRGBA(image.Rect(0, 0, p.Width, p.Height))
var ( var (
@ -107,7 +94,6 @@ func (v *PPMStreamDriver) VideoRecord(p prop.Media) (video.Reader, error) {
draw.Draw(canvas, image.Rect( draw.Draw(canvas, image.Rect(
offsetX, offsetY, offsetX+img.Bounds().Dx(), offsetY+img.Bounds().Dy(), offsetX, offsetY, offsetX+img.Bounds().Dx(), offsetY+img.Bounds().Dy(),
), img, img.Bounds().Min, draw.Over) ), img, img.Bounds().Min, draw.Over)
case <-time.After(time.Second / time.Duration(p.FrameRate)):
default: default:
} }
return canvas, func() {}, nil return canvas, func() {}, nil