tmpfs needed
This commit is contained in:
parent
935d5ade76
commit
3af8cf2090
@ -5,7 +5,6 @@ import (
|
||||
"image"
|
||||
"image/color"
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/nfnt/resize"
|
||||
"github.com/pion/mediadevices/pkg/frame"
|
||||
@ -59,9 +58,6 @@ func (v *PPMStreamDriver) VideoRecord(p prop.Media) (video.Reader, error) {
|
||||
image.YCbCrSubsampleRatio420,
|
||||
)
|
||||
r := video.ReaderFunc(func() (img image.Image, release func(), err error) {
|
||||
ticker := time.NewTicker(time.Second / time.Duration(p.FrameRate))
|
||||
defer ticker.Stop()
|
||||
|
||||
select {
|
||||
case <-v.closed:
|
||||
return nil, func() {}, io.EOF
|
||||
@ -74,7 +70,7 @@ func (v *PPMStreamDriver) VideoRecord(p prop.Media) (video.Reader, error) {
|
||||
}
|
||||
|
||||
// resize image and draw it to canvas
|
||||
resized := resize.Resize(uint(p.Width), uint(p.Height), img, resize.Lanczos3)
|
||||
resized := resize.Resize(uint(p.Width), uint(p.Height), img, resize.Bilinear)
|
||||
for y := 0; y < resized.Bounds().Dy(); y++ {
|
||||
for x := 0; x < resized.Bounds().Dx(); x++ {
|
||||
r, g, b, _ := resized.At(x, y).RGBA()
|
||||
@ -85,7 +81,7 @@ func (v *PPMStreamDriver) VideoRecord(p prop.Media) (video.Reader, error) {
|
||||
canvas.Cr[canvas.COffset(x, y)] = Cr
|
||||
}
|
||||
}
|
||||
case <-ticker.C:
|
||||
default:
|
||||
}
|
||||
return canvas, func() {}, nil
|
||||
})
|
||||
|
@ -39,7 +39,7 @@ func NewServer(o *Options) (*Server, error) {
|
||||
options: o,
|
||||
audioHeader: make(chan *audio.WavHeader, 1),
|
||||
pcm: make(chan []byte),
|
||||
ppm: make(chan io.ReadCloser), // to be configured
|
||||
ppm: make(chan io.ReadCloser, 1), // to be configured
|
||||
}
|
||||
|
||||
u, err := url.Parse(o.QmpAddress)
|
||||
|
Loading…
Reference in New Issue
Block a user