您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

utils.js 1.1KB

1234567891011121314151617181920212223242526272829303132333435
  1. /**
  2. * Polyfill RTCEncoded(Audio|Video)Frame.getMetadata() (not available in M83, available M84+).
  3. * The polyfill can not be done on the prototype since its not exposed in workers. Instead,
  4. * it is done as another transformation to keep it separate.
  5. * TODO: remove when we decode to drop M83 support.
  6. */
  7. export function polyFillEncodedFrameMetadata(encodedFrame, controller) {
  8. if (!encodedFrame.getMetadata) {
  9. encodedFrame.getMetadata = function() {
  10. return {
  11. // TODO: provide a more complete polyfill based on additionalData for video.
  12. synchronizationSource: this.synchronizationSource,
  13. contributingSources: this.contributingSources
  14. };
  15. };
  16. }
  17. controller.enqueue(encodedFrame);
  18. }
  19. /**
  20. * Compares two byteArrays for equality.
  21. */
  22. export function isArrayEqual(a1, a2) {
  23. if (a1.byteLength !== a2.byteLength) {
  24. return false;
  25. }
  26. for (let i = 0; i < a1.byteLength; i++) {
  27. if (a1[i] !== a2[i]) {
  28. return false;
  29. }
  30. }
  31. return true;
  32. }