This message was deleted.
# helpdesk
s
This message was deleted.
f
A couple of things 1. If you are using multiple layers (simulcast), are you measuring only the 720p layer or total? If total, other layers will add up and the total will be close to 2.5 Mbps 2. The bitrate will not be exact all the time. It will be that average over a long window.
c
I am not using the simlulcast. Simulcast option is unchecked
I have gone through this function
Copy code
export function computeVideoEncodings(
  isScreenShare: boolean,
  width?: number,
  height?: number,
  options?: TrackPublishOptions,
): RTCRtpEncodingParameters[] {
  let videoEncoding: VideoEncoding | undefined = options?.videoEncoding;

  if (isScreenShare) {
    videoEncoding = options?.screenShareEncoding;
  }

  const useSimulcast = options?.simulcast;
  const scalabilityMode = options?.scalabilityMode;
  const videoCodec = options?.videoCodec;

  if ((!videoEncoding && !useSimulcast && !scalabilityMode) || !width || !height) {
    // when we aren't simulcasting or svc, will need to return a single encoding without
    // capping bandwidth. we always require a encoding for dynacast
    return [{}];
  }
As per the comment it seems when we are not simlucasting then it is not capping the bandwidth(bitrate) . Could it be a reason for reaching the bitratev far beyond mentioned in the presets..
f
yeah, it is letting the browser defaults take effect in that case. Browser will manage bitrate + resolution based on channel capacity. 720p is the maximum resolution. It will have a default target for that. If bandwidth estimation indicates that channel cannot accommodate that, browser will scale back bitrate and/or resolution to it in channel.
c
And one more difference... the livekit android app is respecting this limitation..In android app it is not happening .. why such different behaviour in these 2 apps
f
Android app maybe passing in the bandwidth. Please file an issue in github in the appropriate repo if this is a problem for your use case with details for repro (code samples, what you expected, what you got, how you measured etc.)
c
okk.. let me check once again in detail.. and i didnt' undertstand this line u mentioned "Android app maybe passing in the bandwidth."
f
JS SDK is not passing in bandwidth cap when not using simulcast. I am saying Android SDK may be passing in bandwidth cap even when not using simulcast.
c
what is the exact meaning of passing here ?
f
Function argument.
c
ohh in that manner
I am trying searching for the place where bitrate is passing as argument in android app code but not able to found.. need some help around here
and how to check client logs.. at what path it created ??
I checked the following function
Copy code
export function videoLayersFromEncodings(
  width: number,
  height: number,
  encodings?: RTCRtpEncodingParameters[],
  svc?: boolean,
): VideoLayer[] {
  // default to a single layer, HQ
  log.debug("//shahdebug2 ",encodings)
  if (!encodings) {
    log.debug("//shahdebug2 returning single layer")
    return [
      new VideoLayer({
        quality: VideoQuality.HIGH,
        width,
        height,
        bitrate: 0,
        ssrc: 0,
      }),
    ];
  }

  if (svc) {
    log.debug("//shahdebug2 ",svc)
    // svc layers
    /* @ts-ignore */
    const encodingSM = encodings[0].scalabilityMode as string;
    const sm = new ScalabilityMode(encodingSM);
    const layers = [];
    for (let i = 0; i < sm.spatial; i += 1) {
      layers.push(
        new VideoLayer({
          quality: VideoQuality.HIGH - i,
          width: Math.ceil(width / 2 ** i),
          height: Math.ceil(height / 2 ** i),
          bitrate: encodings[0].maxBitrate ? Math.ceil(encodings[0].maxBitrate / 3 ** i) : 0,
          ssrc: 0,
        }),
      );
    }
    return layers;
  }
  log.debug("//shahdebug2 not svc")
  
  return encodings.map((encoding) => {
    const scale = encoding.scaleResolutionDownBy ?? 1;
    let quality = videoQualityForRid(encoding.rid ?? '');
    log.debug("shahdebug2 encoding.maxBitrate",encoding.maxBitrate)
    log.debug("//shahdebug2 quality",quality)
    return new VideoLayer({
      quality,
      width: Math.ceil(width / scale),
      height: Math.ceil(height / scale),
      bitrate: encoding.maxBitrate ?? 0,
      ssrc: 0,
    });
    
  });
}
code is going through last return statement when I am running the call with simulcast off option. I tried printing bitrate as well it is coming as undefined. in console. log... That could be the cause of not honouring the limitation placed on bitrate ?? but this code snippet is same in android code also
is we set maxbitrate in encoding does it place capping over bit rate while sending the video ??
f
It is a hint to the encoder. A good resource for these kind of things is MDN WebRTC documentation - https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia. LiveKit uses WebRTC.