passThroughForMp4TrailingMetadataRequest static method

bool passThroughForMp4TrailingMetadataRequest(
  1. ProxyRequest serverRequest,
  2. CacheInfo? cacheInfo
)

Pass through the request for fetching mp4 metadata, this is usually happened when the player detected that the metadata is at the end of the mp4 file.

Implementation

static bool passThroughForMp4TrailingMetadataRequest(ProxyRequest serverRequest, CacheInfo? cacheInfo) {
  RequestRange requestRange = RequestRange.parse(serverRequest.headers['range']);
  if (cacheInfo != null &&
      requestRange.specified &&
      (requestRange.end != null || cacheInfo.total != null) &&
      requestRange.begin != null &&
      ((requestRange.end ?? cacheInfo.total!) - requestRange.begin! < 1024 && !cacheInfo.cached(requestRange))) {
    log('request passed through');
    return true;
  }
  return false;
}