Adds stats to RTMP connection

This commit is contained in:
Alexey Khit
2022-08-18 23:58:22 +03:00
parent 7c23625a24
commit cc00633161
2 changed files with 24 additions and 0 deletions

View File

@@ -22,6 +22,8 @@ type Client struct {
conn *rtmp.Conn
closed bool
receive int
}
func NewClient(uri string) *Client {
@@ -94,6 +96,8 @@ func (c *Client) Handle() (err error) {
return
}
c.receive += len(pkt.Data)
track := c.tracks[int(pkt.Idx)]
timestamp := uint32(pkt.Time / time.Duration(track.Codec.ClockRate))