Пример #1
0
        public void RTCRtpSendParametersCreateAndDeletePtr()
        {
            RTCRtpSendParametersInternal parametersInternal = new RTCRtpSendParametersInternal();

            int encodingsLength = 2;

            RTCRtpEncodingParametersInternal[] encodings = new RTCRtpEncodingParametersInternal[encodingsLength];
            for (int i = 0; i < encodingsLength; i++)
            {
                encodings[i].active                        = true;
                encodings[i].hasValueMaxBitrate            = true;
                encodings[i].maxBitrate                    = 10000000;
                encodings[i].hasValueMaxFramerate          = true;
                encodings[i].maxFramerate                  = 30;
                encodings[i].hasValueScaleResolutionDownBy = true;
                encodings[i].scaleResolutionDownBy         = 1.0;
                encodings[i].rid = Marshal.StringToCoTaskMemAnsi(string.Empty);
            }
            parametersInternal.transactionId   = Marshal.StringToCoTaskMemAnsi(string.Empty);
            parametersInternal.encodingsLength = encodingsLength;
            parametersInternal.encodings       = IntPtrExtension.ToPtr(encodings);
            RTCRtpSendParameters parameter = new RTCRtpSendParameters(parametersInternal);
            IntPtr ptr = parameter.CreatePtr();

            RTCRtpSendParameters.DeletePtr(ptr);
        }
Пример #2
0
        public void SyncHardwareParameters()
        {
            RTCRtpEncodingParametersInternal p = default;

            p.active             = true;
            p.rateControlMode    = Convert.ToUInt32(rateControlMode);
            p.minBitrate         = Convert.ToUInt64(minBitrate);
            p.maxBitrate         = Convert.ToUInt64(maxBitrate);
            p.width              = Convert.ToUInt32(width);
            p.height             = Convert.ToUInt32(height);
            p.minQP              = Convert.ToUInt32(minQP);
            p.maxQP              = Convert.ToUInt32(maxQP);
            p.minFramerate       = Convert.ToUInt32(minFramerate);
            p.maxFramerate       = Convert.ToUInt32(maxFramerate);
            p.intraRefreshPeriod = Convert.ToUInt32(intraRefreshPeriod);
            p.intraRefreshCount  = Convert.ToUInt32(intraRefreshCount);
            p.enableAQ           = enableAQ;
            p.maxNumRefFrames    = Convert.ToUInt32(maxNumRefFrames);
            p.infiniteGOP        = infiniteGOP;

            RTCRtpSender s = new RTCRtpSender();

            s.SetHardwareParameters(p);
        }
        public void RTCRtpSendParametersCreateAndDeletePtr()
        {
            RTCRtpSendParametersInternal parametersInternal = default;

            int encodingsLength = 2;

            RTCRtpEncodingParametersInternal[] encodings = new RTCRtpEncodingParametersInternal[encodingsLength];
            for (int i = 0; i < encodingsLength; i++)
            {
                encodings[i].active                = true;
                encodings[i].maxBitrate            = 10000000;
                encodings[i].minBitrate            = 10000000;
                encodings[i].maxFramerate          = 30;
                encodings[i].scaleResolutionDownBy = 1.0;
                encodings[i].rid = Marshal.StringToCoTaskMemAnsi(string.Empty);
            }
            parametersInternal.transactionId = Marshal.StringToCoTaskMemAnsi(string.Empty);
            parametersInternal.encodings     = encodings;

            RTCRtpSendParameters parameter = new RTCRtpSendParameters(ref parametersInternal);

            parameter.CreateInstance(out var instance);
            instance.Dispose();
        }