-
Notifications
You must be signed in to change notification settings - Fork 283
Update the Unity library to handle split sources #404
Update the Unity library to handle split sources #404
Conversation
Convert WebcamSource and MicrophoneSource to source objects shareable among multiple peer connections.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some potential for hierarchy simplification + minor things to fix, see comments.
- Split audio and video hierarchies - Use base class VideoRendererSource for polymorphic serialization of the source of a VideoRenderer. - Use interfaces for media types (audio or video), and serialize as MonoBehaviour. In the Unity UI, the concrete type used is always known, so we can override the UI and ensure proper filtering and selection mechanisms work as intended.
Move OnEnable/OnDisable implementations into the concrete leaf classes to flatten the track creation and destruction.
Merge the MediaSender and its derived classes AudioSender and VideoSender into the MediaLine itself, since those classes contain very few fields and the logic is entirely internal and managed by the MediaLine object they are attached to.
@@ -61,17 +61,25 @@ protected override async void OnEnable() | |||
} | |||
#endif | |||
|
|||
protected override async Task CreateAudioTrackSourceAsyncImpl() | |||
protected virtual async Task OnEnable() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why virtual?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why indeed ¯_(ツ)_/¯
I think that might have been an automated refactor removing the implementation in the base class, because I don't see why I'd have added that in a leaf class.
Also I just noted there are 2 implementations of OnEnable()
now on UWP, will merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
/// This value must comply with the 'msid' attribute rules as defined in | ||
/// https://tools.ietf.org/html/draft-ietf-mmusic-msid-05#section-2, which in | ||
/// particular constraints the set of allowed characters to those allowed for a | ||
/// 'token' element as specified in https://tools.ietf.org/html/rfc4566#page-43: | ||
/// - Symbols [!#$%'*+-.^_`{|}~] and ampersand & | ||
/// - Alphanumerical characters [A-Za-z0-9] | ||
/// | ||
/// Users can manually test if a string is a valid SDP token with the utility | ||
/// method <see cref="SdpTokenAttribute.Validate(string, bool)"/>. | ||
/// </remarks> | ||
/// <seealso cref="SdpTokenAttribute.Validate(string, bool)"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we test that is a valid SDP token on set
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm is this done when assigning _senderTrackName
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_senderTrackName
has the attribute, so this will make some error message appear when editing the field in the Unity editor if the SDP token is not valid. We can add some extra validation in the setter too for runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just minor outstanding issues.
Convert
WebcamSource
andMicrophoneSource
to source objects shareableamong multiple peer connections.
Because the
SceneVideoSender
component uses the ARGB32 callback, also re-addthat callback, and add a TODO to remove all ARGB32 callbacks in favor of explicit
conversion utility functions, for clarity about the performance implication of the
conversion.
This change also splits the
VideoChatDemo
andSceneCaptureDemo
for clarity,leaving each demo with a single audio and video track per peer connection.
The
SceneCaptureDemo
now has a placeholder showing the capture cameraposition. Multiple tracks per peer connection are demo-ed in the
StandaloneDemo
.All demos are also updated to show essential components as Unity objects in the
scene, instead of adding multiple of them on the same
GameObject
. This helps withdiscoverability.