示例#1
0
    internal void ProcessFrame(Frame frame, FrameSource src)
    {
        try
        {
            lock (_locker)
            {
                if (!Streaming)
                {
                    return;
                }

                Frame f = frame;

                if (profile != null)
                {
                    var filters = profile.ToArray();

                    foreach (var pb in filters)
                    {
                        if (pb == null || !pb.Enabled)
                        {
                            continue;
                        }

                        var r = pb.Process(f, src);
                        if (r != f)
                        {
                            // Prevent from disposing the original frame during post-processing
                            if (f != frame)
                            {
                                f.Dispose();
                            }
                            f = r;
                        }
                    }
                }

                src.FrameReady(f);

                if (f != frame)
                {
                    f.Dispose();
                }
            }
        }
        catch (Exception e)
        {
            Debug.LogException(e);
        }
    }
示例#2
0
    internal void ProcessFrame(Frame frame, FrameSource src)
    {
        try
        {
            Frame f = frame;

            if (profile != null)
            {
                var filters = profile.ToArray();
                // foreach (var pb in profile)
                foreach (var pb in filters)
                {
                    if (pb == null || !pb.Enabled)
                    {
                        continue;
                    }

                    var r = pb.Process(f, src);
                    if (r != f)
                    {
                        f.Dispose();
                        f = r;
                    }
                }
            }

            src.FrameReady(f);

            if (f != frame)
            {
                f.Dispose();
            }
        }
        catch (Exception e)
        {
            Debug.LogException(e);
        }
    }