TS Packet Checker (2 Viewers)

KayDiefenthal

MP Donator
  • Premium Supporter
  • July 18, 2006
    1,176
    92
    45
    Germany - Bonn
    Home Country
    Germany Germany
    an other solution is to put proper setting for VS2019 only inside the project file.

    yes that can be an other option
    but we will see what the best way is
    i will you btw the Team Mediaportal inform to any idea that i have for tspacketchecker or for satip>ip

    so we should stop to write in english before @HTPCSourcer becomes an Heart attack but thanx that you are interessted
     

    alexi

    Portal Member
    January 21, 2010
    35
    0
    Home Country
    Germany Germany
    TS Packet Checker die info steht schon da
    Ts File 152MB
    dvbt2514all.ts

    Ergebnis DemuxToy 1.2.4:
    in diesem 58 s langen TS-File sind fast 3000 Continuity_count_error(s). Das ist sehr viel.

    pids.PNG

    nur NIT und TDT/TOT ist ohne Fehler, ist aber nur selten im TS.

    ts.PNG


    TSPacketChecker zeigt mehr als 19000 cc errors an:
    dropped packets=1 cc errors=19225 pcr holes=0 pts holes=93 total payloadstart errors=0

    dvb-t2.PNG


    SDT (32 services) könnte auch ein Bug sein. Ich zähle nur 19, dabei #770 doppelt und mit unterscheidlichem name. Könnte aber auch an den vielen Fehlern im File liegen.

    Was für ein Gerät (Receiver / TV / PC) / Software hat Du zur Aufnahme von diesem ts verwendet?
    Du solltest TS-Files mit wenigen, am besten 0 Countinity errors verwenden.
    Das sieht bei TSPacketChecker so aus:
    dropped packets=0 cc errors=0 pcr holes=0 pts holes=0 total payloadstart errors=0
    Kann sein dass TSPacketChecker Probleme hat, wenn Errors im File sind.

    und noch ein eventueller bug:
    TSPacketChecker zeigt bei anderen .ts-Files cc errors > 0 an wo DemuxToy 1.2.4 keine Continuity_count_error(s) findet.
    ISO/IEC 13818-1:
    "The continuity_counter shall not be incremented when the adaptation_field_control of the packet equals '00' or '10'."
    scheint in TSPacketChecker nicht implementiert zu sein.
    ich habe in PacketChecks.cs gefunden:

    Code:
        private bool CheckContinuityCounter(byte cc, ref PidInfo pi)
        {
          bool isOk = true;
          if (pi.continuityCounter != 0xFF)
          {
            byte expected = (byte)(pi.continuityCounter + 1);
            if (expected == 16) expected = 0;
            if (cc != expected)
            {
              totalCCErrors++;
              isOk = false;
            }
          }
          pi.continuityCounter = cc;
          return isOk;
        }

    ich vermisse:

    Code:
    if ( not adaptation_field_control of the packet equals '00' or '10')
          {
            byte expected = (byte)(pi.continuityCounter + 1);
          }

    adaptation_field_control of the packet ist vielleicht in AdaptionControl in TsHeader.cs enthalten.
     

    KayDiefenthal

    MP Donator
  • Premium Supporter
  • July 18, 2006
    1,176
    92
    45
    Germany - Bonn
    Home Country
    Germany Germany
    wie das file entstanden ist st relativ einfach

    Code:
    private void RtpListenerThread()
            {
                try
                {
                    try
                    {                   
                       
                        while (!_rtpListenerThreadStopEvent.WaitOne(1)))
                        {
                            byte[] receivedbytes = _udpClient.Receive(ref _serverEndPoint);
                            if(receivedbytes != null)
                            {
                                RtpPacket packet = RtpPacket.Decode(receivedbytes);
                                if((packet.HasPayload)&&(packet.PayloadType == 33))
                                {
                                    _filestream.Write(packet.Payload,0,packet.Payload.Lenght)
                                    _filestream.Flush();
                                }                           
                            }
                        }
                    }
                    finally
                    {
                        switch (_transmissionMode)
                        {
                            case TransmissionMode.Multicast:
                                _udpClient.DropMulticastGroup(_multicastEndPoint.Address);
                                _udpClient.Close();
                                break;
                            case TransmissionMode.Unicast:
                                _udpClient.Close();
                                break;
                        }                   
                    }
                }
                catch (ThreadAbortException)
                {
                }
                catch (Exception ex)
                {
                    Logger.Error(string.Format("SAT>IP : RTP listener thread exception"), ex);
                    return;
                }
                Logger.Warn("SAT>IP : RTP listener thread stopping");
            }


    Code:
    public class RtpPacket
        {
            private static int MinHeaderLength = 12;
            public int HeaderSize = MinHeaderLength;
            public int Version { get; set; }
            public Boolean Padding { get; set; }
            public Boolean Extension { get; set; }
            public int ContributingSourceCount { get; set; }
            public Boolean Marker { get; set; }
            public int PayloadType { get; set; }
            public int SequenceNumber { get; set; }
            public long TimeStamp { get; set; }
            public long SynchronizationSource { get; set; }
            public Collection<string> ContributingSources { get; private set; }
            public int ExtensionHeaderId = 0;
            public int ExtensionHeaderLength = 0;       
            public bool HasPayload { get; set; }
            public byte[] Payload { get; set; }
            public RtpPacket()
            {
               
            }
            public static RtpPacket Decode(byte[] buffer)
            {
                var packet = new RtpPacket();
                packet.Version = buffer[0] >> 6;
                packet.Padding = (buffer[0] & 0x20) != 0;
                packet.Extension = (buffer[0] & 0x10) != 0;
                //packet.ContributingSourceCount = buffer[0] & 0x0f;
                packet.Marker = (buffer[1] & 0x80) != 0;
                packet.PayloadType = buffer[1] & 0x7f;
                packet.SequenceNumber = Utils.Convert2BytesToInt(buffer, 2);
                packet.TimeStamp = Utils.Convert4BytesToLong(buffer, 4);
                packet.SynchronizationSource = Utils.Convert4BytesToLong(buffer, 8);
    
                int index = 12;
    
                if (packet.ContributingSourceCount != 0)
                {
                    packet.ContributingSources = new Collection<string>();
    
                    while (packet.ContributingSources.Count < packet.ContributingSourceCount)
                    {
                        packet.ContributingSources.Add(Utils.ConvertBytesToString(buffer, index, 4));
                        index += 4;
                    }
                }
                var dataoffset = 0;
                if (!packet.Extension)
                    dataoffset = index;
                else
                {
                    packet.ExtensionHeaderId = Utils.Convert2BytesToInt(buffer, index);
                    packet.ExtensionHeaderLength = Utils.Convert2BytesToInt(buffer, index + 2);
                    dataoffset = index + packet.ExtensionHeaderLength + 4;
                }
    
                var dataLength = buffer.Length - dataoffset;
                if (dataLength > dataoffset)
                {
                    packet.HasPayload = true;
                    packet.Payload = new byte[dataLength];
                    Array.Copy(buffer, dataoffset, packet.Payload, 0, dataLength);
                }
                else
                {
                    packet.HasPayload = false;
                }
                return packet;
            }
    
            public override string ToString()
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("RTP Packet");
                sb.AppendFormat("Version: {0} \n", Version);
                sb.AppendFormat("Padding: {0} \n", Padding);
                sb.AppendFormat("Extension: {0} \n", Extension);
                sb.AppendFormat("Contributing Source Identifiers Count: {0} \n", ContributingSourceCount);
                sb.AppendFormat("Marker: {0} \n", Marker);
                sb.AppendFormat("Payload Type: {0} \n", PayloadType);
                sb.AppendFormat("Sequence Number: {0} \n", SequenceNumber);
                sb.AppendFormat("Timestamp: {0} .\n", TimeStamp);
                sb.AppendFormat("Synchronization Source Identifier: {0} \n", SynchronizationSource);
                sb.AppendFormat("\n");
                return sb.ToString();
            }
        }
     

    KayDiefenthal

    MP Donator
  • Premium Supporter
  • July 18, 2006
    1,176
    92
    45
    Germany - Bonn
    Home Country
    Germany Germany
    stark verkürzt
    linux receiver der das tunen auf anfrage des SatIp Clients macht und den PID gefiltert TransportStream als rtp packets über udp rausschickt
    in einem rtp packet sind besten falls 7 ts packets drin also 7*188+12 macht 1328 die 12 sind der rtp header
    vollständige erklärung unter Resources | SAT IP

    das empfängt dann ein Satip Client DVBViewer Mediaportal Nextpvr oder auch Diefenthal/SatIp-Scan-Sample, Diefenthal/SatIp-Rtsp-Sample
     

    alexi

    Portal Member
    January 21, 2010
    35
    0
    Home Country
    Germany Germany
    also komliziert und mit vielen möglichen Fehlerquellen. Da können die rtp packets verloren gehen. Gehen die über LAN oder WLAN?

    DVB-T2-USB-Stick direkt an PC mit DVBDream liefert fast immer fehlerfreie TS-Files.
     

    alexi

    Portal Member
    January 21, 2010
    35
    0
    Home Country
    Germany Germany
    es ist wichtig, dass keine pakete veloren gehen, probier mal TCP falls möglich.

    Ich teste mal den TSPacketChecker mit fehlerfreien DVB-T2 Files um zu sehen, ob die von mir beschriebenen eventuellen bugs dort auch auftreten.
     

    KayDiefenthal

    MP Donator
  • Premium Supporter
  • July 18, 2006
    1,176
    92
    45
    Germany - Bonn
    Home Country
    Germany Germany
    satip hat kein tcp außer für rtsp rtcp und rtp kommen über udp

    sagmal schreibst lieber in visual basic kann das sein ?

    Code:
    if ( not adaptation_field_control of the packet equals '00' or '10')
          {
            byte expected = (byte)(pi.continuityCounter + 1);
          }

    in c# sehe das in etwa so aus

    Code:
    if ((!adaptation_field_control.Equals(00) || (!adaptation_field_control.Equals(10))
                {
                    byte expected = (byte)(pi.continuityCounter + 1);
                }

    not = ! und equals kann man mit .Equals() oder mit == das Or is || und und ist &&
     

    Users who are viewing this thread

    Top Bottom