Skip to content

VP8 simulcast: after setVideoFPS() lowers the temporal layer, raising it again has no effect until a key frame arrives (v1.13.9, possibly related to #4947) #4973

Closed

Description

@xbeerka

Describe the bug

A subscriber lowers the requested frame rate of a VP8 simulcast track with RemoteTrackPublication.setVideoFPS(5) and later raises it with setVideoFPS(30). After the raise it keeps receiving only the base temporal layer, a quarter of the frames. The full frame rate comes back only when a key frame arrives, for example when the subscriber switches to another spatial layer. Without a spatial switch it stayed at 5 fps for as long as we waited: 30 s in the minimal test below, 84 s in an application test.

A VP9 SVC track (L3T3_KEY) from the same publisher recovers in 1–2 seconds and needs no key frame.

Versions

  • livekit-server v1.13.9, Docker image livekit/livekit-server:v1.13.9, single node
  • livekit-client 2.22.3, adaptiveStream: false, dynacast: true
  • Publisher and subscriber: Chrome 154 on macOS. In application-level tests a Chromium 148 publisher on Linux behaves the same.
  • Publisher: publishTrack(track, { videoCodec: 'vp8', simulcast: true }), camera 1280×720 at 20 fps. This gives the default three rids (q/h/f) with three temporal layers each. The dependency-descriptor header extension is negotiated on the publisher's sender.

To reproduce

Plain SDK, no application code:

  1. The publisher joins and publishes a VP8 simulcast camera track.
  2. The subscriber joins and, on TrackSubscribed, calls publication.setVideoQuality(VideoQuality.LOW).
  3. At 15 s: publication.setVideoFPS(5).
  4. At 35 s: publication.setVideoFPS(30).
  5. At 65 s: publication.setVideoQuality(VideoQuality.MEDIUM).
  6. Every second, log the deltas of framesDecoded and keyFramesDecoded from the receiver's inbound-rtp stats.

Observed

Decoded frames per second. K marks a second in which a key frame was decoded.

VP8 simulcast, two runs with the same result:

20 20 20 20 20K 20 20 20 20 20 20 20 20
| 15s setVideoFPS(5) |          20 8 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
| 35s setVideoFPS(30) |         5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
| 65s setVideoQuality(MEDIUM) | 5 21K 20 20 20 20 21 19 21 20 20 20 20 20 20 20

VP9 L3T3_KEY, same script with { videoCodec: 'vp9', scalabilityMode: 'L3T3_KEY' }:

20 20 19 20 20 21 20 20 19 21 19 21 19
| 15s setVideoFPS(5) |          21 6 5 5 5 6 5 5 5 5 5 5 5 5 5 5 5 5 5 5
| 35s setVideoFPS(30) |         5 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 21 19 21 19 21 20 20 20 20 20 20 20 20 20
| 65s setVideoQuality(MEDIUM) | 20 20K 20 20 20 20 21 20 20 20 20 20 20 20 20 20

Expected

After setVideoFPS(30) the VP8 subscriber gets the full frame rate back within about a second, as the VP9 subscriber does.

What we checked

  • pkg/sfu/videolayerselector/temporallayerselector/vp8.go at v1.13.9, changed by fix: switch VP8 temporal layer up only at a layer sync frame #4947 in v1.13.8. An up-switch needs a key frame, or a frame of layer current + 1 with both S and Y set.
  • Chrome does encode such frames. We read frame dependencies with an encoded transform on the sender (VP8, three temporal layers, same Chrome build). They repeat as T0, T2*, T1*, T2, T0, T2, T1, T2, where * means the frame depends only on T0. So a T1 frame that depends only on the base layer occurs once every 8 frames, every 0.4 s at 20 fps. The pattern is the same with maxFramerate: 10 and at 40–120 kbit/s. We therefore expected the selector to step T0 → T1 → T2 within about a second.
  • We could not inspect the Y bit on the wire. We do not know whether it is missing from the packets or not seen by the selector. The dependency descriptor extension is present on these packets, in case that path matters.
  • We have not run this script against v1.13.7. We upgraded from v1.13.7 to v1.13.9 two days ago. In an application-level test the night before the upgrade, a subscriber that raised its fps request did start receiving the higher temporal layer.

Impact

A client that uses setVideoFPS to shed load cannot undo it for VP8 publishers unless the spatial layer changes. In our service these are phones, laptops with fewer than 8 cores, Safari and Firefox, about 30 % of participants. In a grid where tiles stay on the lowest layer, the video stays at a quarter of the frame rate. When the publisher is on a constrained uplink and encodes about 7 fps, the subscriber is left with under 2 fps.

Possible directions

Subscriber part of the test page
const room = new LivekitClient.Room({ adaptiveStream: false, dynacast: true });
let pub = null, t0 = 0;
room.on(LivekitClient.RoomEvent.TrackSubscribed, (track, publication) => {
  if (track.kind !== 'video' || pub) return;
  pub = publication; track.attach(document.getElementById('v')); t0 = performance.now();
  pub.setVideoQuality(LivekitClient.VideoQuality.LOW);
  setTimeout(() => pub.setVideoFPS(5), 15_000);
  setTimeout(() => pub.setVideoFPS(30), 35_000);
  setTimeout(() => pub.setVideoQuality(LivekitClient.VideoQuality.MEDIUM), 65_000);
  let prev = null;
  const tick = async () => {
    const stats = await track.receiver.getStats(); let cur = null;
    stats.forEach(r => { if (r.type === 'inbound-rtp' && r.kind === 'video') cur = r; });
    if (cur && prev) console.log(Math.round((performance.now() - t0) / 1000),
      cur.framesDecoded - prev.framesDecoded, cur.keyFramesDecoded - prev.keyFramesDecoded, cur.frameHeight);
    prev = cur;
    if (performance.now() - t0 < 80_000) setTimeout(tick, 1000);
  };
  setTimeout(tick, 1000);
});
await room.connect(url, token, { autoSubscribe: true });

Publisher: createLocalVideoTrack({ resolution: { width: 1280, height: 720, frameRate: 20 } }), then publishTrack(track, { videoCodec: 'vp8', simulcast: true }).

Activity

  1. added a commit that references this issue on Oct 10, 2026
    b90b0ca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions