mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 23:26:54 +08:00
examples: print write errors (#810)
This commit is contained in:
@@ -15,8 +15,8 @@ import (
|
||||
|
||||
// This example shows how to
|
||||
// 1. create a RTSP server which accepts plain connections.
|
||||
// 2. allow a single client to publish a stream with TCP or UDP.
|
||||
// 3. allow multiple clients to read the stream with TCP, UDP or UDP-multicast.
|
||||
// 2. allow a single client to publish a stream.
|
||||
// 3. allow several clients to read the stream.
|
||||
|
||||
type serverHandler struct {
|
||||
server *gortsplib.Server
|
||||
@@ -150,7 +150,10 @@ func (sh *serverHandler) OnRecord(ctx *gortsplib.ServerHandlerOnRecordCtx) (*bas
|
||||
// called when receiving a RTP packet
|
||||
ctx.Session.OnPacketRTPAny(func(medi *description.Media, _ format.Format, pkt *rtp.Packet) {
|
||||
// route the RTP packet to all readers
|
||||
sh.stream.WritePacketRTP(medi, pkt) //nolint:errcheck
|
||||
err := sh.stream.WritePacketRTP(medi, pkt)
|
||||
if err != nil {
|
||||
log.Printf("ERR: %v", err)
|
||||
}
|
||||
})
|
||||
|
||||
return &base.Response{
|
||||
|
Reference in New Issue
Block a user