Skip to content

Commit a3c0719

Browse files
committed
streamd: Add callerAddress and callerPort to srtStats
1 parent d411113 commit a3c0719

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

streamd/gstreamer_srt_stats.go

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package main
22

33
import (
4+
"errors"
45
"fmt"
6+
"net"
57
"time"
68
"unsafe"
79

10+
"github.com/go-gst/go-glib/glib"
811
"github.com/go-gst/go-gst/gst"
912
)
1013

@@ -68,7 +71,8 @@ type srtCallerStats struct {
6871

6972
negotiatedLatencyMS int
7073

71-
// callerAddress net.IP
74+
callerAddress net.IP
75+
callerPort uint16
7276
}
7377

7478
// Retrieve value from name and convert it to the correct time (known at compile time)
@@ -148,6 +152,19 @@ func (s *srtStats) convertCallerStats(arr []interface{}) error {
148152
return fmt.Errorf("struct has wrong mimetype '%s'", name)
149153
}
150154

155+
socketAddress, err := gs.GetValue("caller-address")
156+
if err != nil {
157+
return err
158+
}
159+
socketAddressObj, ok := socketAddress.(*glib.Object)
160+
if ok != true {
161+
return errors.New("caller-address is not a glib object")
162+
}
163+
sc.callerAddress, sc.callerPort, err = inetSocketAddressIP(socketAddressObj.Unsafe())
164+
if err != nil {
165+
return err
166+
}
167+
151168
intProps := []struct {
152169
dest *int
153170
name string

0 commit comments

Comments
 (0)