Update pion/interceptor for NACKs

Generate + Respond interceptors
This commit is contained in:
tarrencev
2020-12-13 22:57:08 -08:00
committed by Sean DuBois
parent 85ced4ad69
commit a54b74cdb7
15 changed files with 162 additions and 29 deletions

View File

@@ -54,10 +54,23 @@ func main() {
if err != nil {
panic(err)
}
if _, err = peerConnection.AddTrack(videoTrack); err != nil {
rtpSender, err := peerConnection.AddTrack(videoTrack)
if err != nil {
panic(err)
}
// Read incoming RTCP packets
// Before these packets are retuned they are processed by interceptors. For things
// like NACK this needs to be called.
go func() {
rtcpBuf := make([]byte, 1500)
for {
if _, _, rtcpErr := rtpSender.Read(rtcpBuf); rtcpErr != nil {
return
}
}
}()
// Set the handler for ICE connection state
// This will notify you when the peer has connected/disconnected
peerConnection.OnICEConnectionStateChange(func(connectionState webrtc.ICEConnectionState) {