Skip to content

Twilio duplicate null tracks #2146

@PrakashC1

Description

@PrakashC1

Problem description:
We are seeing duplicate RemoteTrack objects where one is valid and another appears as a “null track.” This happens when a participant joins a room late (after publisher participant has already published 2 video tracks). The "trackSubscribed" event does fire, but the "trackStarted" event never fires in these cases. The track object exists, but it has no active media — codec, dimensions, frameRate, packets, and bytes are all null. Effectively, it is a dead track.

To work around this, we added a retry button: when the video is not playing, we leave the room and rejoin the same room. Sometimes this solves the problem, but sometimes it happens again even after rejoining. The issue is inconsistent: Sometimes the first time in a newly created room everything works fine. Leaving and rejoining the same room can trigger the problem. In other cases, even rejoining does not fix it.

From WebRTC DevTools, it looks like Twilio sometimes maps to the inactive SSRC/encoding instead of the active one. This leads to situations where the subscriber receives a dead track (track object exists but media never flows).

Steps to Reproduce

  1. Participant-1 joins the room and publishes 2 video tracks.
  2. Participant-2 joins later.
  3. Participant-2 receives "trackSubscribed" events for both tracks.
  4. Sometimes the subscribed track is active (video frames flow).
  5. Sometimes a duplicate track object is received where everything inside is null.

Observed Behavior

  • "trackSubscribed" callback provides a track object.
  • But the track has no active media (stats all null or 0).
  • DevTools shows duplicate SSRC entries for the same trackId. Twilio seems to pick the inactive one.
  • This happens more frequently with VP9 codec.

Expected Behavior

  • "trackSubscribed" should always provide the actual active RemoteTrack with media.
  • There should not be duplicate/null track objects for the same track SID.

Environment

  1. twilio-video.js: 2.32.1
  2. Browser: Chrome : 140.0.7339.80
  3. Codec: VP9
  4. Platform: [Windows/macOS]

EXample:

For privacy reasons, I can’t share the full DevTools HAR file (it contains my application’s APIs).
Below is the relevant videoEvents socket stats-report snippet that shows the duplicate/null track

{
"type": "connect",
"token": "",
"version": 1,
"publisher": {
"name": "twilio-video.js",
"sdkVersion": "2.32.1",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36",
"participantSid": "PAdde369f46dbe05472b27c82aaae34a2a",
"roomSid": "RM08c2e435e874a9c6ef500c94665cc4a3"
}
}

states-report:


{
"group": "quality",
"name": "stats-report",
"payload": {
"elapsedTime": 11784,
"level": "info",
"audioTrackStats": [],
"localAudioTrackStats": [],
"localVideoTrackStats": [],
"peerConnectionId": "cb6b2244-91cb-4baa-a217-42d86801742a",
"videoTrackStats": [
{
"trackId": "9b391bbd-8f8e-4fd4-bf96-594c3705cd69",
"trackSid": "MT3b890653a1a43e7519cc89965749389b",
"timestamp": 1757416016783,
"ssrc": "2529585046",
"packetsLost": 0,
"codec": "VP9",
"bytesReceived": 1395541,
"packetsReceived": 1331,
"dimensions": {
"width": 880,
"height": 600
},
"frameRate": 23,
"avgDecodeDelay": 2,
"avgJitterBufferDelay": 7
},
{
"trackId": "09e590aa-5b18-446f-b453-48ef74053507",
"trackSid": "MTfd117e16084defb541eaab84c749347e",
"timestamp": 1757416016783,
"ssrc": "1543073157",
"packetsLost": 0,
"codec": "VP9",
"bytesReceived": 1391255,
"packetsReceived": 1327,
"dimensions": {
"width": 880,
"height": 600
},
"frameRate": 23,
"avgDecodeDelay": 2,
"avgJitterBufferDelay": 6
},
{
"trackId": "9b391bbd-8f8e-4fd4-bf96-594c3705cd69",
"trackSid": "MT3b890653a1a43e7519cc89965749389b",
"timestamp": 0,
"packetsLost": null,
"codec": null,
"bytesReceived": null,
"packetsReceived": null,
"dimensions": null,
"frameRate": null
},
{
"trackId": "09e590aa-5b18-446f-b453-48ef74053507",
"trackSid": "MTfd117e16084defb541eaab84c749347e",
"timestamp": 0,
"packetsLost": null,
"codec": null,
"bytesReceived": null,
"packetsReceived": null,
"dimensions": null,
"frameRate": null
}
]
},
"timestamp": 1757416016876,
"type": "event",
"version": 1,
"session": "2257b28c-8298-429d-ad13-a20a1dfdd5c6"
}

Could anyone help me on this? Thank you in advance.

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