PacketsLost may not provide useful if repairs are discounting the loss.
So, out-of-order packets are an indication of loss and maybe subsequent
repair. Note that out-of-order could be just out-of-order by a short
amount of time, but a lot of that happening is not good either.
So, out-of-order could provide a decent view of link quality.
* Prevent race of new track and new receiver.
Two different concepts
1. Creation of a new media track
2. Creation of a new receiver inside the media track
collided and caused track published to not be fired.
Unify to mark creation of new receiver as the source of truth.
With simulcast codecs, creation of a new receiver should be treated as a
new published track.
* Fire onTrackPublished only on new track
* Synthesise codec when adding pending track for no simulcast case also.
Older clients not using simulcast codecs were failing e2e migration
tests. Problem is that they did not have layer information and hence
SSRC could not be set on migration.
A codec was getting added later (when OnTrack was received). I missed
adding layers in that code. Could have cloned layers there and added it.
But, simplifying and adding at the start itself.
Also, cleaning up code in `MediaTrackReceiver` for no codecs case as it
should not happen any more.
* clone per layer
* fix priority determination
Previously, it was done on read. Missed populating it on write
in the TrackInfo consolidation effort.
Fix by populating layers when adding pending track itself.
As all codecs will have same layers, clone the top level layers and add
it all codecs.
* Consolidate TrackInfo.
TrackInfo was spread across a bit. Consolidating it.
* TODO comments
* test
* update TrackInfo on SSRC change
* further consolidation
* log mimes only
* update receivers on SSRC set
* clone proto on return
* feedback: break loop on mime match
* prevent data race
Need to store identity of other partiicpant in cache so that it
can be sent with the disconnected participant update.
Side note: Feels like the cache can be made to hold the full proto
to make things simpler, but just adding a field for now.