Beispiel #1
0
            public async Task PushPacket(MPEGTS.Packet pkt)
            {
                //track from PES start
                if (!TransportStreams.ContainsKey(pkt.Pid) && pkt.PayloadUnitStart)
                {
                    TransportStreams.Add(pkt.Pid, new PESStream(pkt));
                    await OnPacket(pkt.Pid, pkt.Payload);
                }
                else if (TransportStreams.TryGetValue(pkt.Pid, out PESStream stream) && pkt.HasPayload)
                {
                    if (pkt.PayloadUnitStart && pkt.Continuity == 0 && stream.Continuity == 15)
                    {
                        stream.Continuity = pkt.Continuity;
                    }
                    else if (pkt.Continuity - 1 == stream.Continuity)
                    {
                        stream.Continuity = pkt.Continuity;
                    }
                    else
                    {
                        //out of order
                        //throw new Exception("Out of order pkt");
                    }
                    await OnPacket(pkt.Pid, pkt.Payload);

                    stream.Packets.Add(pkt);
                }
            }
Beispiel #2
0
 public PESStream(MPEGTS.Packet pkt)
 {
     Continuity = pkt.Continuity;
     Packets.Add(pkt);
 }