qpSum 特性为 RTCRtpStreamStats dictionary is a value generated by adding the Quantization Parameter ( QP ) values for every frame sent or received to date on the video track corresponding to this RTCRtpStreamStats 对象。 In general, the higher this number is, the more heavily compressed the video data is.

句法

var qpSum = RTCRtpStreamStats.qpSum;
					

An unsigned 64-bit integer value which indicates the sum of the quantization parameter (QP) value for every frame sent or received so far on the track described by the RTCRtpStreamStats object. Since the value of QP is typically larger to indicate higher compression factors, the larger this sum is, the more heavily compressed the stream generally has been.

注意: This value is only available for video media.

用法注意事项

Quantization is the process of applying lossy compression to a range of values, resulting in a single quantum value . This value takes the place of the range of values, thereby reducing the number of different values that appear in the overall data set, making the data more compressible. The quantization process and the amount of compression can be controlled using one or more parameters.

It's important to keep in mind that the value of QP can change periodically—even every frame—so it's difficult to know for certain how substantial the compression is. The best you can do is make an estimate. You can, for example, use the value of RTCReceivedRtpStreamStats.framesDecoded if receiving the media or RTCSentRtpStreamStats.framesEncoded if sending it to get the number of frames handled so far, and compute an average from there. See Calculating average quantization below for a function that does this.

Also, the exact meaning of the QP value depends on the codec being used. For example, for the VP8 codec, the QP value can be anywhere from 1 to 127 and is found in the frame header element "y_ac_qi" , whose value is defined in RFC 6386: 19.2 . H.264 uses a QP which ranges from 0 to 51; in this case, it's an index used to derive a scaling matrix used during the quantization process. Additionally, QP is not likely to be the only parameter the codec uses to adjust the compression. See the individual codec specifications for details.

范例

Calculating average quantization

calculateAverageQP() function shown below computes the average QP for the given RTCRtpStreamStats object, returning 0 if the object doesn't describe an RTP stream.

function calculateAverageQP(stats) {
  let frameCount = 0;
  switch(stats.type) {
    case "inbound-rtp":
    case "remote-inbound-rtp":
      frameCount = stats.framesDecoded;
      break;
    case "outbound-rtp":
    case "remote-outbound-rtp":
      frameCount = stats.framesEncoded;
      break;
    默认:
      return 0;
  }
  return status.qpSum / frameCount;
}
					

规范

规范 状态 注释
Identifiers for WebRTC's Statistics API
The definition of 'RTCInboundRtpStreamStats: qpSum' in that specification.
候选推荐 初始定义。
Identifiers for WebRTC's Statistics API
The definition of 'RTCOutboundRtpStreamStats: qpSum' in that specification.
候选推荐 初始定义。

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
qpSum Chrome No Edge No Firefox 66 IE No Opera No Safari ? WebView Android No Chrome Android No Firefox Android 66 Opera Android No Safari iOS ? Samsung Internet Android No

图例

完整支持

完整支持

不支持

不支持

兼容性未知 ?

兼容性未知

元数据

  • 最后修改: