mediadevices/rtpreader.go
Valentin Cocaud cd6aaa1393 Force key frame on PLI
Also make the ReadCloser an Controllable allows to uncouple
the controller implementation from the encoder.
This is not needed for the 2 codec controller already implemented (openh264 and vpx)
but is more future proof in case it required for other codecs.
2022-07-25 10:51:35 -04:00

31 lines
634 B
Go

package mediadevices
import (
"github.com/pion/mediadevices/pkg/codec"
"github.com/pion/rtp"
)
type RTPReadCloser interface {
Read() (pkts []*rtp.Packet, release func(), err error)
Close() error
codec.Controllable
}
type rtpReadCloserImpl struct {
readFn func() ([]*rtp.Packet, func(), error)
closeFn func() error
controllerFn func() codec.EncoderController
}
func (r *rtpReadCloserImpl) Read() ([]*rtp.Packet, func(), error) {
return r.readFn()
}
func (r *rtpReadCloserImpl) Close() error {
return r.closeFn()
}
func (r *rtpReadCloserImpl) Controller() codec.EncoderController {
return r.controllerFn()
}