Report publish & subscribe RTPStats as Telemetry events (#1506)

This commit is contained in:
David Zhao authored and GitHub committed 2023-03-10 10:28:54 -08:00
1 parent e7e8bbe72c
commit 5ff72a99b9
10 files changed
+184 -25

No files matched your search

+8
View File
@@ -87,6 +87,7 @@ type Buffer struct {
onRtcpFeedback func([]rtcp.Packet)
onRtcpSenderReport func(*RTCPSenderReportData)
onFpsChanged func()
onFinalRtpStats func(*RTPStats)
// logger
logger logger.Logger
@@ -321,6 +322,9 @@ func (b *Buffer) Close() error {
if b.rtpStats != nil {
b.rtpStats.Stop()
b.logger.Infow("rtp stats", "direction", "upstream", "stats", b.rtpStats.ToString())
if b.onFinalRtpStats != nil {
b.onFinalRtpStats(b.rtpStats)
}
}
if b.onClose != nil {
@@ -693,6 +697,10 @@ func (b *Buffer) OnRtcpSenderReport(fn func(srData *RTCPSenderReportData)) {
b.onRtcpSenderReport = fn
}
func (b *Buffer) OnFinalRtpStats(fn func(*RTPStats)) {
b.onFinalRtpStats = fn
}
// GetMediaSSRC returns the associated SSRC of the RTP stream
func (b *Buffer) GetMediaSSRC() uint32 {
return b.mediaSSRC