All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m34s
24 lines
405 B
Go
24 lines
405 B
Go
package main
|
|
|
|
import (
|
|
"github.com/pion/rtp"
|
|
"github.com/pion/webrtc/v4"
|
|
)
|
|
|
|
type Track struct {
|
|
Local *webrtc.TrackLocalStaticRTP
|
|
}
|
|
|
|
func NewTrack(remote *webrtc.TrackRemote) *Track {
|
|
local, _ := webrtc.NewTrackLocalStaticRTP(
|
|
remote.Codec().RTPCodecCapability,
|
|
remote.ID(),
|
|
remote.StreamID(),
|
|
)
|
|
return &Track{Local: local}
|
|
}
|
|
|
|
func (t *Track) Write(pkt *rtp.Packet) {
|
|
t.Local.WriteRTP(pkt)
|
|
}
|