`Event::MediaAdded` is not fired for medias added in local offer
The MediaAdded event documentation states that
This event fires both for negotiations triggered by a remote or local offer.
Which is not the case, since it is emitted only for media lines added via remote offer, and it seems that firing these event for local offer is explicitly disabled right here: 0, 1.
And, yeah, while this is an apply_answer() function it is also when local offer is being applied too, so i guess it should also cause MediaAdded event to fire.
So is this an expected behaviour and outdated documentation or a bug? I can prepare a PR if its the second case.
Very good question. 🤔
It sounds like a bug. @xnorpx, @k0nserv, @davibe anyone got thoughts?
We only use direct API, but if I remember correctly, it will fire for local added streams.
I don't think we should fire it when the user explicitly added the media, I believe this aligns with the spec too. I consulted our usage too, we don't expect it to fire on locally added media
So a PR adjusting the doc to that effect?
So a PR adjusting the doc to that effect?
I think so yes.
We only use direct API, but if I remember correctly, it will fire for local added streams.
I did verify that when we add our local streams with direct API we are getting MediaAdded events.
(We are not using it)
I did verify that when we add our local streams with direct API we are getting MediaAdded events.
Ah, and I'm using SDP api and not getting MediaAdded for media that's added in local offer.
I don't think we should fire it when the user explicitly added the media, I believe this aligns with the spec too.
I'm okay with both options, just want to be sure that it works as expected and won't change someday.
So a PR adjusting the doc to that effect?
Works for me. I'll prepare a PR (regarding RTX cache drop ratio) in the next few days and i can update this doc there. So feel free to close this issue, or I'll close it after doc is updated.
I did verify that when we add our local streams with direct API we are getting MediaAdded events.
Ok. So PR to fix docs and change this behavior.
@xnorpx
I did verify that when we add our local streams with direct API we are getting MediaAdded events.
Wonder if this was with an older str0m? In my fix in #655 I wrote a test for this but I don't find that declare_media results in MediaAdded.
I did verify that when we add our local streams with direct API we are getting MediaAdded events.
Wonder if this was with an older str0m? In my fix in #655 I wrote a test for this but I don't find that
declare_mediaresults inMediaAdded.
Possible, I can see if I get time to verify this again this week.