gpt4 book ai didi

ios - 我可以使用 TokBox OTSubscriberKitNetworkStatsDelegate 来计算带宽吗

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:38:52 24 4
gpt4 key购买 nike

我正在使用 TokBox 构建一个视频 session 应用程序。我想向用户指示流的表现如何。我注意到 OTSubscriberKitNetworkStatsDelegate 让您可以查看订阅者丢失了多少音频和视频数据包。不清楚的是,这是否表明您或他们的连接状况良好。我假设我可以使用这个委托(delegate)来查看我自己丢弃的数据包(作为发布者和订阅者)。这是计算 TokBox 某种带宽指标的方法吗?

更新:很好的答案,也很快!令人印象深刻的 OpenTok 社区。最后,OTNetworkTest 很棒,实际上使用 OTSubscriberKitNetworkStatsDelegate 来计算流的质量,正如我所怀疑的那样。它的唯一问题是它被设计为在您开始 session 之前运行。我需要一个可以作为现有 session 的一部分运行的测试;因此,我将去掉计算部分并创建一个使用您自己的订户数据的此类版本。感谢大家的帮助。

最佳答案

实际上有几种方法。

天真的想法

粗略但简单地计算帧的大小并将其乘以帧率(实际帧率,未指定),然后加上声音的 kbps。您应该非常准确地了解实际带宽。对于帧速率计算,请阅读 Dynamic frame rate controls

OpenTok 方法(合法的方法)

我敢打赌,一个好的用户体验解决方案不是显示一切都不好,而是调整流质量,仅在完全失败的情况下指示错误(就像 Skype 所做的那样)。看看这个:

Starting with our 2.7.0 mobile SDK release, you can start a publisher with per-determined video resolution and frames per seconds (fps). Before using the API, you should be aware of the following:

  1. Though HD video sounds like a good idea at first, from a practical standpoint you may run into issues with device CPU load on low to medium range devices. You may also be limited by the user’s available bandwidth. Lastly, data charges for your users could run high.
  2. Available on the device. The actual empirical values for these parameters will vary based on the specific device. Your selection can be seen as a maximum for the resolution and frame rate you are willing to publish.
  3. Automatically adjusted based on various parameters like a user’s packet loss, CPU utilization, and network bandwidth/bit-rate. Rather than attempting to do this dynamically on your own, we recommend picking meaningful values and allowing OpenTok to handle the fine tuning.

  4. Bandwidth, set your publisher video type property to “screen” instead of the default “camera” value.

取自here

所以,这是你应该做的:实现 <OTSubscriberKitNetworkStatsDelegate>协议(protocol)第一。它有一个方法叫做 - (void)subscriber:(OTSubscriberKit *)subscriber videoNetworkStatsUpdated:(OTSubscriberKitVideoNetworkStats *)stats如您所见,其中有一个 OTSubscriberKitVideoNetworkStats传递给它的对象。接下来,您可以从此对象中提取三个属性:

  1. @property (readonly) uint64_t videoPacketsLost - 此订阅者丢失的估计视频数据包数。
  2. @property (readonly) uint64_t videoPacketsReceived - 此订阅者收到的视频数据包数。
  3. @property (readonly) uint64_t videoBytesReceived – 此订阅者收到的视频字节数。
  4. @property (readonly) double timestamp – 收集这些统计数据的时间戳,自 Unix 纪元以来以毫秒为单位。

因此,请随意尝试这些值(value)观并为您的应用实现最佳解决方案。

此外,他们还发表了一篇专门针对管理电话 session 不同带宽的文章。 Check it out .

更新:

当我在写答案时,@JaideepShah 提到了一个惊人的例子。通读 this example 的解释.有一张表指示我上面提到的正确值的正确分辨率。

关于ios - 我可以使用 TokBox OTSubscriberKitNetworkStatsDelegate 来计算带宽吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35803911/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com