From df22ea3a44f31b89cc81d26ac3c2ac30436e9e6d Mon Sep 17 00:00:00 2001 From: Josh Deprez Date: Tue, 23 Apr 2024 14:17:41 +1000 Subject: [PATCH] Add RTMP status --- router/rtmp.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/router/rtmp.go b/router/rtmp.go index c9515aa..18891bf 100644 --- a/router/rtmp.go +++ b/router/rtmp.go @@ -24,6 +24,7 @@ import ( "gitea.drjosh.dev/josh/jrouter/atalk" "gitea.drjosh.dev/josh/jrouter/atalk/rtmp" + "gitea.drjosh.dev/josh/jrouter/status" "github.com/google/gopacket/pcap" "github.com/sfiera/multitalk/pkg/aarp" "github.com/sfiera/multitalk/pkg/ddp" @@ -41,6 +42,11 @@ type RTMPMachine struct { // Run executes the machine. func (m *RTMPMachine) Run(ctx context.Context, incomingCh <-chan *ddp.ExtPacket) error { + ctx, setStatus, done := status.AddSimpleItem(ctx, "RTMP") + defer done() + + setStatus("Awaiting DDP address assignment") + // Await local address assignment before doing anything <-m.AARP.Assigned() myAddr, ok := m.AARP.Address() @@ -48,11 +54,15 @@ func (m *RTMPMachine) Run(ctx context.Context, incomingCh <-chan *ddp.ExtPacket) return fmt.Errorf("AARP machine closed Assigned channel but Address is not valid") } + setStatus("Initial RTMP Data broadcast") + // Initial broadcast if err := m.broadcastData(myAddr); err != nil { log.Printf("RTMP: Couldn't broadcast Data: %v", err) } + setStatus("Packet loop") + bcastTicker := time.NewTicker(10 * time.Second) defer bcastTicker.Stop()