getStats()用空的RTCSTATSREPORP调用OnstatsDeliver

GetStats() call OnStatsDelivered with an empty RTCStatsReport

本文关键字:RTCSTATSREPORP 调用 OnstatsDeliver getStats      更新时间:2023-10-16

我正在使用新的 WEBRTC Stats api 带有 rtcstatsCollectorCallback 在生成stats Report时称为"称为"的对象。我是Invoke GetStats((,然后我可以看到, onstatsDelivered 均使用RTCSTATSReport调用,该rtcstatsReport仅包含Stats_成员中的一个(空(项目。在 getStats(( call I传递了我自己的RTCSTATSCOLLECTORCALLBACK的实现,该rtcstatscollectorCallback实现了WebRTC :: RTCSTATSCOLLECTORCALLBACK接口。我的问题是,为了获得指标的rtcstatsreport,在peerconnection中进行了某些设置或约束吗?我的意思是,要获取,例如Kstatsvaluenamertt Stat,我需要在PeerConnection中设置一些东西。请注意,我正在分支 55 中使用 C 本机API 。这个新的统计API是否已完整?

我已经使用了成功的旧GetStats方法:

bool GetStats(StatsObserver* observer,
            webrtc::MediaStreamTrackInterface* track,
            StatsOutputLevel level) override;

可能是您的问题是由于尝试使用过程中的API(WebRTC框架有点野外(。目前,peerconnectiointernface.h说以下内容:

// Gets stats using the new stats collection API, see webrtc/api/stats/. These
// will replace old stats collection API when the new API has matured enough.
// TODO(hbos): Default implementation that does nothing only exists as to not
// break third party projects. As soon as they have been updated this should
// be changed to "= 0;".
virtual void GetStats(RTCStatsCollectorCallback* callback) {}

当我写这篇回应时,您的问题已有6个月大,因此该新API现已起作用(尽管上面的评论建议否则(。