I'm still working on fixing the leaking of all CallDialogs and I just
noticed that you've modified AbstractMediaDevice to keep a reference
to the last MediaDeviceSession it has created - you've introduced a
MediaDeviceSession field called session and a getSession() method and
you've modified the createSession method. This is incorrect and needs
to be fixed because:
(1) A MediaDevice instance is a representation of a hardware device
instance and it is kept alive as long as the hardware device instance
is connected to the computer and accessible to Jitsi. A
MediaDeviceSession instance represents a specific use of a MediaDevice
and it has a shorter lifespan e.g. during a Call. Obviously, a single
hardware device may have multiple uses at one and the same time i.e. a
MediaDevice may create multiple MediaDeviceSessions which are alive at
one and the same time. In such a case, having a single session field
is inaccurate and/or incomplete at best.
(2) Remembering a MediaDeviceSession in a MediaDevice without clearing
it once the MediaDeviceSession is closed in a memory leak.
It's true that there are MediaDevice implementations which keep track
of their MediaDeviceSessions in Jitsi but these are special-purpose
MediaDevices such as the audio mixer and the video translator. They
are, however, different because they are created with special-purpose
methods of MediaService such as createMixer.