Edit

Share via


AudioChannelTemplate.SendDirectionSamplingRate Property

Definition

Gets or sets the Sampling Rate for the send direction.

public:
 property Microsoft::Rtc::Collaboration::AudioVideo::AudioSamplingRate SendDirectionSamplingRate { Microsoft::Rtc::Collaboration::AudioVideo::AudioSamplingRate get(); void set(Microsoft::Rtc::Collaboration::AudioVideo::AudioSamplingRate value); };
public Microsoft.Rtc.Collaboration.AudioVideo.AudioSamplingRate SendDirectionSamplingRate { get; set; }
member this.SendDirectionSamplingRate : Microsoft.Rtc.Collaboration.AudioVideo.AudioSamplingRate with get, set
Public Property SendDirectionSamplingRate As AudioSamplingRate

Property Value

Exceptions

Thrown when assigned value is not defined in enumerated type.

Examples

The following example changes SendDirectionSamplingRate and applies it to an AudioVideoFlow.

C# Modifying AudioChannelTemplate properties.


AudioVideoFlowTemplate templateToApply = new AudioVideoFlowTemplate(audioVideoFlow);
AudioChannelTemplate audioChannelTemplate = (AudioChannelTemplate)templateToApply.Audio.GetChannels()[ChannelLabel.AudioMono];
audioChannelTemplate.AllowedDirection = MediaChannelDirection.SendOnly;
audioChannelTemplate.SendDirectionSamplingRate = AudioSamplingRate.EightKhz;

// ApplyChanges
audioVideoFlow.BeginApplyChanges(
    templateToApply,
    new AsyncCallback(delegate(IAsyncResult result)
    {
        try
        {
            audioVideoFlow.EndApplyChanges(result);
        }
        catch (RealTimeException e)
        {
            // handle exception
            throw e;
        }

        // ApplyChanges is done, verify changes result..
        AudioChannel audioChannel = audioVideoFlow.Audio.GetChannels()[ChannelLabel.AudioMono];
        if (audioChannel.Direction == MediaChannelDirection.SendOnly &&
            audioChannel.SendDirectionSamplingRate == AudioSamplingRate.EightKhz)
        {
            // remote side accepted changes as they were
        }
        else
        {
            // remote side accepted changes but filtered them more.
        }
    }),
    this);



Remarks

This restriction prevents the application from enabling audio formats on the send direction of the audio channel which are not enabled on the receive direction. Otherwise, allowing such a configuration might cause a failure in which media from the peer endpoint could not be received.

Applies to