我正在使用新的RTCStatsCollectorCallback对象WebRTC stats ,在生成stats报告时调用该对象。我调用了GetStats(),然后我可以看到OnStatsDelivered是用一个RTCStatsReport调用的,该RTCStatsReport只包含stats_成员中的一个(空)项。在GetStats()调用中,我传递了实现webrtc::RTCStatsCollectorCallback接口的RTCStatsCollectorCallback的实现。我的问题是,是否需要在PeerConnection中设置某些设置或约束,以获得具有度量的RTCStatsReport?我的意思是,要获得,例如,kStatsValueNameRtt统计数据,我需要在PeerConnection中设置一些东西。请注意,在分支C++ 55中使用的是本机API。这个新的stats完全实现了吗?
发布于 2017-11-07 10:07:27
我成功地使用了旧的GetStats
方法:
bool GetStats(StatsObserver* observer,
webrtc::MediaStreamTrackInterface* track,
StatsOutputLevel level) override;
这可能是您的问题是由于尝试使用一个正在进行的API (webrtc框架有点疯狂西方)。目前,PeerconnectioInterface.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现在可能正在运行(尽管上面的注释表明并非如此)。
https://stackoverflow.com/questions/43680040
复制