static getCommonDrmInfos(drms1, drms2) {
    if (!drms1.length) {
      return drms2;
    }
    if (!drms2.length) {
      return drms1;
    }

    const commonDrms = [];

    for (const drm1 of drms1) {
      for (const drm2 of drms2) {
        if (drm1.keySystem == drm2.keySystem) {
          const initDataMap = new Map();
          const bothInitDatas = (drm1.initData || [])
              .concat(drm2.initData || []);
          for (const d of bothInitDatas) {
            initDataMap.set(d.keyId, d);
          }
          const initData = Array.from(initDataMap.values());

          const keyIds = drm1.keyIds && drm2.keyIds ?
              new Set([...drm1.keyIds, ...drm2.keyIds]) :
              drm1.keyIds || drm2.keyIds;
          const mergedDrm = {
            keySystem: drm1.keySystem,
            licenseServerUri: drm1.licenseServerUri || drm2.licenseServerUri,
            distinctiveIdentifierRequired: drm1.distinctiveIdentifierRequired ||
                drm2.distinctiveIdentifierRequired,
            persistentStateRequired: drm1.persistentStateRequired ||
                drm2.persistentStateRequired,
            videoRobustness: drm1.videoRobustness || drm2.videoRobustness,
            audioRobustness: drm1.audioRobustness || drm2.audioRobustness,
            serverCertificate: drm1.serverCertificate || drm2.serverCertificate,
            serverCertificateUri: drm1.serverCertificateUri ||
                drm2.serverCertificateUri,
            initData,
            keyIds,
          };
          commonDrms.push(mergedDrm);
          break;
        } else {
          if (shaka.drm.DrmUtils.isClearKeyWihRawKey_(drm1)) {
            commonDrms.push(drm1);
          } else if (shaka.drm.DrmUtils.isClearKeyWihRawKey_(drm2)) {
            commonDrms.push(drm2);
          }
        }
      }
    }

    return commonDrms;
  }
Returns an array of drm infos that are present in both input arrays.
If one of the arrays is empty, returns the other one since clear
content is considered compatible with every drm info.

@param {!Array<!shaka.extern.DrmInfo>} drms1
@param {!Array<!shaka.extern.DrmInfo>} drms2
@return {!Array<!shaka.extern.DrmInfo>}