Exemple #1
0
 internal void CopyInternal(ref RTCRtpEncodingParametersInternal instance)
 {
     instance.active             = active;
     instance.hasValueMaxBitrate = maxBitrate.HasValue;
     if (maxBitrate.HasValue)
     {
         instance.maxBitrate = maxBitrate.Value;
     }
     instance.hasValueMinBitrate = minBitrate.HasValue;
     if (minBitrate.HasValue)
     {
         instance.minBitrate = minBitrate.Value;
     }
     instance.hasValueMaxFramerate = maxFramerate.HasValue;
     if (maxFramerate.HasValue)
     {
         instance.maxFramerate = maxFramerate.Value;
     }
     instance.hasValueScaleResolutionDownBy = scaleResolutionDownBy.HasValue;
     if (scaleResolutionDownBy.HasValue)
     {
         instance.scaleResolutionDownBy = scaleResolutionDownBy.Value;
     }
     instance.rid = string.IsNullOrEmpty(rid) ? IntPtr.Zero : Marshal.StringToCoTaskMemAnsi(rid);
 }
Exemple #2
0
 internal RTCRtpEncodingParameters(ref RTCRtpEncodingParametersInternal parameter)
 {
     active                = parameter.active;
     maxBitrate            = parameter.maxBitrate;
     minBitrate            = parameter.minBitrate;
     maxFramerate          = parameter.maxFramerate;
     scaleResolutionDownBy = parameter.scaleResolutionDownBy;
     if (parameter.rid != IntPtr.Zero)
     {
         rid = parameter.rid.AsAnsiStringWithFreeMem();
     }
 }
Exemple #3
0
 internal void CreateInstance(out RTCRtpSendParametersInternal instance)
 {
     instance = default;
     RTCRtpEncodingParametersInternal[] encodings =
         new RTCRtpEncodingParametersInternal[this.encodings.Length];
     for (int i = 0; i < this.encodings.Length; i++)
     {
         this.encodings[i].CopyInternal(ref encodings[i]);
     }
     instance.encodings     = encodings;
     instance.transactionId = Marshal.StringToCoTaskMemAnsi(transactionId);
 }
 internal RTCRtpEncodingParameters(RTCRtpEncodingParametersInternal parameter)
 {
     active = parameter.active;
     if (parameter.hasValueMaxBitrate)
         maxBitrate = parameter.maxBitrate;
     if (parameter.hasValueMaxFramerate)
         maxFramerate = parameter.maxFramerate;
     if (parameter.hasValueScaleResolutionDownBy)
         scaleResolutionDownBy = parameter.scaleResolutionDownBy;
     if(parameter.rid != IntPtr.Zero)
         rid = parameter.rid.AsAnsiStringWithFreeMem();
 }
 internal IntPtr CreatePtr()
 {
     RTCRtpEncodingParametersInternal[] encodings =
         new RTCRtpEncodingParametersInternal[_encodings.Length];
     for(int i = 0; i < _encodings.Length; i++)
     {
         _encodings[i].CopyInternal(ref encodings[i]);
     }
     RTCRtpSendParametersInternal instance = default;
     instance.encodingsLength = _encodings.Length;
     instance.encodings = IntPtrExtension.ToPtr(encodings);
     instance.transactionId = Marshal.StringToCoTaskMemAnsi(_transactionId);
     IntPtr ptr = Marshal.AllocCoTaskMem(Marshal.SizeOf(instance));
     Marshal.StructureToPtr(instance, ptr, false);
     return ptr;
 }