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 int Init(string appId, string channelId)
        {
            int ret = -1;

            app_id_     = appId;
            channel_id_ = channelId.Split(';').GetValue(0).ToString();

            if (null == rtc_engine_)
            {
                rtc_engine_ = AgoraRtcEngine.CreateAgoraRtcEngine();
            }

            LogConfig        log_config     = new LogConfig(agora_sdk_log_file_path_);
            RtcEngineContext rtc_engine_ctx = new RtcEngineContext(app_id_, AREA_CODE.AREA_CODE_GLOB, log_config);

            ret = rtc_engine_.Initialize(rtc_engine_ctx);
            CSharpForm.dump_handler_(JoinChannelVideo_TAG + "Initialize", ret);
            // second way to set logfile
            //ret = rtc_engine_.SetLogFile(log_file_path);
            //CSharpForm.dump_handler_(JoinChannelVideo_TAG + "SetLogFile", ret);

            event_handler_ = new JoinChannelVideoEventHandler(this);
            rtc_engine_.InitEventHandler(event_handler_);

            return(ret);
        }
Esempio n. 3
0
        internal override int Init(string appId, string channelId)
        {
            int ret = -1;

            app_id_     = appId;
            channel_id_ = channelId.Split(';').GetValue(0).ToString();

            if (null == rtc_engine_)
            {
                rtc_engine_ = AgoraRtcEngine.CreateAgoraRtcEngine();
            }
            LogConfig        log_config     = new LogConfig(agora_sdk_log_file_path_);
            RtcEngineContext rtc_engine_ctx = new RtcEngineContext(app_id_, AREA_CODE.AREA_CODE_GLOB, log_config);

            ret = rtc_engine_.Initialize(rtc_engine_ctx);
            CSharpForm.dump_handler_(ProcessRawData_TAG + "Initialize", ret);

            event_handler_ = new ProcessRawDataEventHandler(this);
            rtc_engine_.InitEventHandler(event_handler_);

            audio_frame_observer = new ProcessRawDataAudioFrameObserver();
            rtc_engine_.RegisterAudioFrameObserver(audio_frame_observer);

            video_frame_observer = new ProcessRawDataVideoFrameObserver();
            rtc_engine_.RegisterVideoFrameObserver(video_frame_observer);

            return(ret);
        }
        internal override int Init(string appId, string channelId)
        {
            int ret = -1;

            app_id_     = appId;
            channel_id_ = channelId.Split(';').GetValue(0).ToString();

            if (null == rtc_engine_)
            {
                rtc_engine_ = AgoraRtcEngine.CreateAgoraRtcEngine();
            }
            LogConfig        log_config     = new LogConfig(agora_sdk_log_file_path_);
            RtcEngineContext rtc_engine_ctx = new RtcEngineContext(app_id_, AREA_CODE.AREA_CODE_GLOB, log_config);

            ret = rtc_engine_.Initialize(rtc_engine_ctx);
            CSharpForm.dump_handler_("Initialize", ret);
            event_handler_ = new ScreenShareEventHandler(this);
            rtc_engine_.InitEventHandler(event_handler_);

            if (null == screen_share_engine_)
            {
                screen_share_engine_ = AgoraRtcEngine.CreateAgoraRtcEngine(AgoraEngineType.SubProcess);
            }
            ret = screen_share_engine_.Initialize(rtc_engine_ctx);
            CSharpForm.dump_handler_(ScreenShare_TAG + "Initialize", ret);

            //screen_share_event_handler_ = new ScreenShareEventHandler(this);
            //screen_share_engine_.InitEventHandler(screen_share_event_handler_);

            return(ret);
        }
Esempio n. 5
0
        private void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
            }

            _agoraRtcEngine = null;
            _disposed       = true;
        }
Esempio n. 6
0
        internal override int Init(string appId, string channelId)
        {
            int ret = -1;

            app_id_ = appId;
            var channels = channelId.Split(';');

            if (channels.Length < 2)
            {
                return(-1);
            }
            first_channel_id_  = channelId.Split(';').GetValue(0).ToString();
            second_channel_id_ = channelId.Split(';').GetValue(1).ToString();

            if (null == rtc_engine_)
            {
                rtc_engine_ = AgoraRtcEngine.CreateAgoraRtcEngine();
            }
            LogConfig        log_config     = new LogConfig(agora_sdk_log_file_path_);
            RtcEngineContext rtc_engine_ctx = new RtcEngineContext(app_id_, AREA_CODE.AREA_CODE_GLOB, log_config);

            ret = rtc_engine_.Initialize(rtc_engine_ctx);
            CSharpForm.dump_handler_(JoinMultipleChannel_TAG + "Initialize", ret);
            //event_handler_ = new JoinMultipleChannelEventHandler(this);
            //rtc_engine_.InitEventHandler(event_handler_);
            rtc_engine_.SetChannelProfile(CHANNEL_PROFILE_TYPE.CHANNEL_PROFILE_LIVE_BROADCASTING);

            first_channel_ = rtc_engine_.CreateChannel(first_channel_id_);
            ret            = first_channel_.SetClientRole(CLIENT_ROLE_TYPE.CLIENT_ROLE_BROADCASTER);
            CSharpForm.dump_handler_(JoinMultipleChannel_TAG + "SetClientRole(ch1)", ret);
            first_channel_event_handler_ = new JoinMultipleChannelChannelEventHandler(this);
            first_channel_.InitEventHandler(first_channel_event_handler_);

            second_channel_ = rtc_engine_.CreateChannel(second_channel_id_);
            ret             = second_channel_.SetClientRole(CLIENT_ROLE_TYPE.CLIENT_ROLE_AUDIENCE);
            CSharpForm.dump_handler_(JoinMultipleChannel_TAG + "SetClientRole(ch2)", ret);
            second_channel_event_handler_ = new JoinMultipleChannelChannelEventHandler(this);
            second_channel_.InitEventHandler(second_channel_event_handler_);

            return(ret);
        }
Esempio n. 7
0
 internal AudioEffectManager(AgoraRtcEngine agoraRtcEngine)
 {
     _agoraRtcEngine = agoraRtcEngine;
 }