InvalidStateError when resuming a producer with replaceTrack

Hi all.

We ran into a bug and I’d like to determine if the problem is with our logical flow or if the error comes from somewhere else.

From the Mediasoup docs, which are usually on point, I am making two assumptions about pause/resume.

  1. It does not matter which side calls pause / resume first - client or server
  2. Consumers are automatically paused and resumed if their producer pauses / resumes

With these assumptions, I think this logic would be legal:

  1. Client-side producer is paused
  2. Server-side producer is paused
  3. Client-side consumers are paused
  4. Client-side producer.replaceTrack is called with a new MediaStreamTrack
  5. Client-side producer is resumed
  6. Server-side producer is resumed

At step 6 we get an InvalidStateError (Channel is closed) and the worker closes

My question is, should this in fact work or did I misunderstand something about the pause/resume process?

Cheers!

That error happens when the mediasoup worker crashes, so please report an issue in GitHub by telling mediasoup version and follow crash procedure explained in mediasoup :: Support

1 Like

Thank you ibc. It seems it WAS a bug but is no longer. I’ve updated versions from 3.10.8 to latest and it doesn’t occur anymore. :pray:

Edit: found out with debug logs that it was an out_of_range error