Ejemplo n.º 1
0
        public bool OnReceiveData(object obj)
        {
            IAVFrame packet = (IAVFrame)obj;

            if (packet == null)
            {
                return(false);
            }
            IPipe pipe = null;

            lock (router)
            {
                if (router.ContainsKey(packet.FrameType))
                {
                    pipe = router[packet.FrameType];
                }
            }
            if (pipe == null)
            {
                List <IPipe> list = null;
                lock (nextComponents)
                {
                    list = new List <IPipe>(nextComponents);
                }
                foreach (IPipe p in list)
                {
                    AvDecoder decoder = p as AvDecoder;
                    if (decoder == null)
                    {
                        continue;
                    }
                    lock (router)
                    {
                        router.Add(decoder.FrameType, p);
                    }
                    if (decoder.FrameType == packet.FrameType)
                    {
                        pipe = p;
                    }
                }
            }
            if (pipe == null)
            {
                return(false);
            }
            RecordLog();
            pipe.OnReceiveData(obj);

            return(true);
        }