private IAgoraRtcEngine GetEngine()
        {
            var engine = AgoraRtcEngine.Get(AgoraEngineType);

            if (_needUpdateInfo && engine != null)
            {
                if (_videoStreamManager == null)
                {
                    _videoStreamManager = ((AgoraRtcEngine)engine).GetVideoStreamManager();
                }

                if (_videoStreamManager != null)
                {
                    _videoStreamManager.EnableVideoFrameCache(VideoPixelWidth, VideoPixelHeight, Uid, ChannelId);
                }
                _needUpdateInfo = false;
                _needResize     = true;
                FreeMemory();
                _cachedVideoFrame = new IrisRtcVideoFrame
                {
                    type     = VIDEO_FRAME_TYPE.FRAME_TYPE_RGBA,
                    y_stride = VideoPixelWidth * 4,
                    height   = VideoPixelHeight,
                    y_buffer = Marshal.AllocHGlobal(VideoPixelWidth * VideoPixelHeight * 4)
                };
            }

            return(engine);
        }
        internal override bool GetVideoFrame(ref IrisRtcVideoFrame video_frame,
                                             ref bool is_new_frame, uint uid, string channel_id = "")
        {
            if (_agoraRtcEngine == null)
            {
                AgoraLog.LogError(string.Format("EnableVideoFrameCache ret: ${0}", ERROR_CODE_TYPE.ERR_NOT_INITIALIZED));
                return(false);
            }

            IntPtr irisEngine = (_agoraRtcEngine as AgoraRtcEngine).GetNativeHandler();

            if (irisEngine != IntPtr.Zero)
            {
                var rawDataPtr = AgoraRtcNative.GetIrisRtcRawData(irisEngine);
                var renderPtr  = AgoraRtcNative.GetIrisRtcRenderer(rawDataPtr);

                return(AgoraRtcNative.GetVideoFrame(renderPtr, ref video_frame, out is_new_frame, uid, channel_id));
            }
            return(false);
        }
 internal abstract bool GetVideoFrame(ref IrisRtcVideoFrame video_frame,
                                      ref bool is_new_frame, uint uid, string channel_id = "");
示例#4
0
 internal static extern void ClearVideoFrame(ref IrisRtcVideoFrame video_frame);
示例#5
0
 internal static extern IrisRtcVideoFrame ConvertVideoFrame(ref IrisRtcVideoFrame src, VIDEO_FRAME_TYPE format);
示例#6
0
 internal static extern bool GetVideoFrame(IrisRtcRendererPtr renderer_ptr, ref IrisRtcVideoFrame video_frame,
                                           out bool is_new_frame, uint uid, string channel_id = "");