private void PrepareBackchannelProfile(Profile profile, MediaConfigurationChangeLog changeLog, string Codec) { AudioOutputConfiguration[] Outputs = GetAudioOutputConfigurations(); if (Outputs == null) { Assert(false, "No AudioOutputConfigurations available", "Checking AudioOutputConfigurations"); } foreach (AudioOutputConfiguration o in Outputs) { if ((o.SendPrimacy != null) && (o.SendPrimacy == "www.onvif.org/ver20/HalfDuplex/Server")) { AudioOutputConfigurationOptions opt = GetAudioOutputConfigurationOptions(o.token, null); if (opt != null && opt.SendPrimacyOptions != null) { string s = opt.SendPrimacyOptions.FirstOrDefault(c => c != "www.onvif.org/ver20/HalfDuplex/Server"); if (s != null) { o.SendPrimacy = s; changeLog.TrackModifiedConfiguration(o); SetAudioOutputConfiguration(o, false); } } } if ((o.SendPrimacy != null) && (o.SendPrimacy == "www.onvif.org/ver20/HalfDuplex/Server")) { continue; } AddAudioOutputConfiguration(profile.token, o.token); AudioDecoderConfiguration[] Decoders = GetCompatibleAudioDecoderConfigurations(profile.token); if (Decoders == null) { Assert(false, "No AudioDecoderConfigurations available", "Checking AudioDecoderConfigurations"); } bool DecoderFound = false; foreach (AudioDecoderConfiguration d in Decoders) { AudioDecoderConfigurationOptions Options = GetAudioDecoderConfigurationOptions(d.token, profile.token); if (Options == null) { continue; } if (Codec == "G711" && Options.G711DecOptions == null) { continue; } if (Codec == "G726" && Options.G726DecOptions == null) { continue; } if (Codec == "AAC" && Options.AACDecOptions == null) { continue; } AddAudioDecoderConfiguration(profile.token, d.token); DecoderFound = true; break; } Assert(DecoderFound, "No suitable AudioDecoder available", "Checking AudioDecoderConfigurationOptions"); } }
private bool TuneBackchannelProfile(Profile profile, MediaConfigurationChangeLog changeLog, string Codec) { AudioOutputConfiguration o = profile.Extension.AudioOutputConfiguration; if ((o.SendPrimacy != null) && (o.SendPrimacy == "www.onvif.org/ver20/HalfDuplex/Server")) { AudioOutputConfigurationOptions opt = GetAudioOutputConfigurationOptions(o.token, null); if (opt != null && opt.SendPrimacyOptions != null) { string s = opt.SendPrimacyOptions.FirstOrDefault(c => c != "www.onvif.org/ver20/HalfDuplex/Server"); if (s != null) { o.SendPrimacy = s; changeLog.TrackModifiedConfiguration(o); SetAudioOutputConfiguration(o, false); } } } if ((o.SendPrimacy != null) && (o.SendPrimacy == "www.onvif.org/ver20/HalfDuplex/Server")) { return(false); } AudioDecoderConfiguration d = profile.Extension.AudioDecoderConfiguration; AudioDecoderConfigurationOptions Options = GetAudioDecoderConfigurationOptions(d.token, profile.token); if (Options == null) { return(false); } if (Codec == "G711" && Options.G711DecOptions == null) { return(false); } if (Codec == "G726" && Options.G726DecOptions == null) { return(false); } if (Codec == "AAC" && Options.AACDecOptions == null) { return(false); } return(true); }