示例#1
0
        public override void Discard()
        {
            encoder?.Stop();
            encoder?.Dispose();
            encoder = null;

            EventEmitter.Instance.Unsubscribe(eventName, onReceiveImage);
            base.Discard();
        }
示例#2
0
        public void Run(BaseWorker worker)
        {
            try {
                encoder.Stop();
                encoder.Start($"rtmp://{Global.gCloudRtmpIP}:{Global.gCloudRtmpPort}/live/{streamId}");
            }
            catch (Exception e) {
                Tracker.LogE(e);
                OnFault();
                return;
            }

            while (!worker.IsTerminated())
            {
                try {
                    IntPtr addr = imageGCHandle.AddrOfPinnedObject();
                    encoder.Encode(addr, addr + imageSize, addr + imageSize + imageSize / 4);
                }
                catch (Exception e) {
                    Tracker.LogE(e);
                    encoder.Stop();
                    OnFault();
                    return;
                }

                Thread.Sleep(1000 / cell.mCell.mIRCameraVideoFrameRate);
            }

            try {
                encoder.Encode(IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
                encoder.Stop();
                Stop();
            }
            catch (Exception e) {
                Tracker.LogE(e);
            }
        }