Because codecs have varying performance characteristics, Microsoft Unified Communications Managed API 2.0 Core SDK exposes the UseHighPerformanceproperty, which enables developers to choose between better server performance or better audio quality for their applications. UseHighPerformanceis a property on the AudioChannelTemplateclass in the Microsoft.Rtc.Collaboration.AudioVideonamespace.
Setting the UseHighPerformanceproperty to truecauses the UCMA 2.0 Core SDK platform to exclude lower-performance audio codes such as RTAudio-WB and RTAudio-NB. Setting the property to falsecauses the platform to include lower-performance audio codecs such as RTAudio-WB or RTAudio-NB.
Performance gain comes from reducing the time spent encoding and decoding audio, of which the more time-expensive operation is encoding. Encoding is particularly expensive with RTAudio. The UseHighPerformancesetting limits the choice of codes to those that can more quickly encode and decode audio packets.
Using the UseHighPerformance Property
For UCMA 2.0 Core SDK applications that require optimal server performance and scalability, set the UseHighPerformanceproperty to true.
The following code shows a handler for the AudioVideoFlowConfigurationRequestedevent on an AudioVideoCallinstance. The handler can be used for incoming and outgoing audio/video calls. In this code example, the UseHighPerformanceproperty is set to true, thereby selecting server performance over audio quality.
Copy Code | |
---|---|
private void UserAvCall_AudioVideoFlowConfigurationRequested(object sender, AudioVideoFlowConfigurationRequestedEventArgs e) { AudioVideoCall call = sender as AudioVideoCall; AudioVideoFlowTemplate template = new AudioVideoFlowTemplate(call.Flow); // Set High Performance template.Audio.Channels[ChannelLabel.AudioMono].UseHighPerformance = true; call.Flow.Initialize(template); } |