ant-media / Ant-Media-Server

Ant Media Server is a live streaming engine software that provides adaptive, ultra low latency streaming by using WebRTC technology with ~0.5 seconds latency. Ant Media Server is auto-scalable and it can run on-premise or on-cloud.
https://antmedia.io
Other
4.22k stars 617 forks source link

RTCPeerConnection has audio tracks added (and enabled) even when initialized with audio:false #6209

Closed MaZZly closed 23 hours ago

MaZZly commented 5 months ago

Short description

We initialize the JS SDK like:

this.webRTCAdaptor = new WebRTCAdaptor({
    websocket_url: antWSUrl,
    mediaConstraints: {
        video: videoConstraints,
        audio: false,
    },
    ....
})

When inspecting this.webRTCAdaptor.remotePeerConnection senders and receivers we see MediaStreamTrack of type kind: audio that are enabled: true...

Steps to reproduce

  1. Initialize SDK with audio: false
  2. start publishing & subscribing to video streams
  3. Check the RTCPeerConnection

Expected behavior

The RTCPeerConnections should not have any MediaTrack where kind: audio when we have explicitly disabled it in the beginning.

Actual behavior

The RTCPeerConnections have MediaTracks where kind: audio and enabled: true are added..

MaZZly commented 5 months ago

@mustafaboleken can you clarify if this is the intended behavior due to e.g. WebRTC, or if it is a bug?

mustafaboleken commented 5 months ago

As far as I know, it's not an intended behavior but let me discuss with my collegues. I will let you know.

MaZZly commented 5 months ago

@mustafaboleken, thanks; I'm thinking this is quite a critical bug if audio/video tracks are still being sent even when not initialized to be...

MaZZly commented 4 months ago

@mustafaboleken has there been any progress on this one?

mustafaboleken commented 4 months ago

Hi @MaZZly,

I hope you are doing well. I have some findings that I wanted to discuss with you in order to discuss a couple of things related to React Native and this issue. Do you have some time next week for a meeting? After the discussion, I wanted to create pull requests.

MaZZly commented 4 months ago

Yeah sure, still quite open for next week. Send an invite to my email I'll let you know if it works :)

mekya commented 4 months ago

Hi @mustafaboleken,

What's the current status of this issue?

Cheers Oguz

MaZZly commented 3 months ago

This can also be seen in the multitrack conference, where we listen to obj.stream.onremovetrack to handle streams stopping.

if (info === 'newTrackAvailable') {
    obj.stream.onremovetrack = (event: MediaStreamTrackEvent) => {
        console.log(event.track.kind);
    }
}

The above code will log 2 entries: video and audio, even though we don't have audio enabled when initializing the WebRTCAdaptor object

mustafaboleken commented 2 weeks ago

Hi MaZZly,

I hope you are doing well. Let me explain how the multitrack conference works. Whenever you join a room with more than 1 participant, you will have 2 RTCPeerConnection. One is for publishing to the server, and the other is for playing the room (main track). I tested the scenario that you raised and saw that, if I make the audio false, then I don't have an audio track for publishing but I have audio tracks for the peer connection which is used by play functionality even if all the participants are video-only participants. So, it's an expected behavior.

mustafaboleken commented 23 hours ago

I'm closing this issue due to the inactivity. If you need to discuss it in the future, feel free to reopen the issue.