Share via


Adjusting Application Performance

Because codecs have varying performance characteristics, Microsoft Unified Communications Managed API (UCMA) 3.0 Core SDK exposes the UseHighPerformance property, which enables developers to choose between better server performance or better audio quality for their applications. UseHighPerformance is a property on the AudioChannelTemplate class in the Microsoft.Rtc.Collaboration.AudioVideo namespace.

Setting the UseHighPerformance property to true causes the UCMA 3.0 Core SDK platform to exclude lower-performance audio codes such as RTAudio-WB and RTAudio-NB. Setting the property to false causes 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 UseHighPerformance setting limits the choice of codecs to those that can more quickly encode and decode audio packets.

Using the UseHighPerformance Property

For UCMA 3.0 Core SDK applications that require optimal server performance and scalability, set the UseHighPerformance property to true.

The following code shows a handler for the AudioVideoFlowConfigurationRequested event on an AudioVideoCall instance. The handler can be used for incoming and outgoing audio/video calls. In this code example, the UseHighPerformance property is set to true, thereby selecting server performance over audio quality.

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);
}