Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse transceivers to reduce signal size #462

Open
Mfron-42 opened this issue Apr 30, 2019 · 6 comments
Open

Reuse transceivers to reduce signal size #462

Mfron-42 opened this issue Apr 30, 2019 · 6 comments

Comments

@Mfron-42
Copy link

I noticed that the signals keep on growing as I add new streams. Seems like removed stream are still referenced in futur signals. After a fewe cycles of adding and removing a stream the signal grows to more than 100ko.

@t-mullen
Copy link
Collaborator

t-mullen commented May 4, 2019

WebRTC’s Unified Plan never actually removes transceivers from the connection, so they stick around in the session description. There’s no way to remove them.

You can reuse transceivers with peer.replaceTrack instead of calling peer.addTrack again.

@t-mullen
Copy link
Collaborator

t-mullen commented May 4, 2019

I thought about this some more - it'd be nice to automatically reuse transceivers when calling addTrack.

@t-mullen t-mullen changed the title signal size Reuse transceivers to reduce signal size May 4, 2019
@fippo
Copy link

fippo commented May 5, 2019

actually it does, this is called "m-line recycling" (and there have been spec changes recently). Implementations may vary though.

@t-mullen
Copy link
Collaborator

t-mullen commented May 6, 2019

@fippo How would we go about recycling m-lines? I can't seem to find a description of this.

Do we set the transceiver's direction to inactive and the recycling happens eventually?

@fippo
Copy link

fippo commented May 6, 2019

This is something the browser would do when you call transceiver.stop() which marks the m-line in the SDP as inactive. - which isn't implemented in Chrome yet.

If the problem is caused by using addTrack and removeTrack to start and stop media, using replaceTrack on the same sender might avoid the problem.

@arun3528
Copy link

Yep replace track with null and change the direction works

    const result = Media.checkTracks(type, sendTrack && track, receiveTrack);

    transceiver.direction = result.direction;
    if (options.track) {
      transceiver.sender.replaceTrack(track);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants