examples: print write errors (#810)

This commit is contained in:
Alessandro Ros
2025-06-28 12:42:37 +02:00
committed by GitHub
parent ebf9912f77
commit f4ef4ec23a
8 changed files with 43 additions and 20 deletions

View File

@@ -2,6 +2,7 @@
package main
import (
"fmt"
"log"
"github.com/bluenviron/gortsplib/v4"
@@ -57,7 +58,10 @@ func main() {
// read RTP packets from the reader and route them to the publisher
reader.OnPacketRTPAny(func(_ *description.Media, _ format.Format, pkt *rtp.Packet) {
publisher.WritePacketRTP(desc.Medias[0], pkt) //nolint:errcheck
err2 := publisher.WritePacketRTP(desc.Medias[0], pkt)
if err2 != nil {
fmt.Printf("ERR: %v", err2)
}
})
// start playing