public void HeaderRoundTripTest() { logger.LogDebug("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name); logger.BeginScope(System.Reflection.MethodBase.GetCurrentMethod().Name); RTPHeader src = new RTPHeader(); byte[] headerBuffer = src.GetHeader(1, 0, 1); RTPHeader dst = new RTPHeader(headerBuffer); logger.LogDebug("Versions: " + src.Version + ", " + dst.Version); logger.LogDebug("PaddingFlag: " + src.PaddingFlag + ", " + dst.PaddingFlag); logger.LogDebug("HeaderExtensionFlag: " + src.HeaderExtensionFlag + ", " + dst.HeaderExtensionFlag); logger.LogDebug("CSRCCount: " + src.CSRCCount + ", " + dst.CSRCCount); logger.LogDebug("MarkerBit: " + src.MarkerBit + ", " + dst.MarkerBit); logger.LogDebug("PayloadType: " + src.PayloadType + ", " + dst.PayloadType); logger.LogDebug("SequenceNumber: " + src.SequenceNumber + ", " + dst.SequenceNumber); logger.LogDebug("Timestamp: " + src.Timestamp + ", " + dst.Timestamp); logger.LogDebug("SyncSource: " + src.SyncSource + ", " + dst.SyncSource); logger.LogDebug("Raw Header: " + System.Text.Encoding.ASCII.GetString(headerBuffer, 0, headerBuffer.Length)); Assert.True(src.Version == dst.Version, "Version was mismatched."); Assert.True(src.PaddingFlag == dst.PaddingFlag, "PaddingFlag was mismatched."); Assert.True(src.HeaderExtensionFlag == dst.HeaderExtensionFlag, "HeaderExtensionFlag was mismatched."); Assert.True(src.CSRCCount == dst.CSRCCount, "CSRCCount was mismatched."); Assert.True(src.MarkerBit == dst.MarkerBit, "MarkerBit was mismatched."); Assert.True(src.SequenceNumber == dst.SequenceNumber, "PayloadType was mismatched."); Assert.True(src.HeaderExtensionFlag == dst.HeaderExtensionFlag, "SequenceNumber was mismatched."); Assert.True(src.Timestamp == dst.Timestamp, "Timestamp was mismatched."); Assert.True(src.SyncSource == dst.SyncSource, "SyncSource was mismatched."); }
public void HeaderRoundTripTest() { Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name); RTPHeader src = new RTPHeader(); byte[] headerBuffer = src.GetHeader(1, 0, 1); RTPHeader dst = new RTPHeader(headerBuffer); Console.WriteLine("Versions: " + src.Version + ", " + dst.Version); Console.WriteLine("PaddingFlag: " + src.PaddingFlag + ", " + dst.PaddingFlag); Console.WriteLine("HeaderExtensionFlag: " + src.HeaderExtensionFlag + ", " + dst.HeaderExtensionFlag); Console.WriteLine("CSRCCount: " + src.CSRCCount + ", " + dst.CSRCCount); Console.WriteLine("MarkerBit: " + src.MarkerBit + ", " + dst.MarkerBit); Console.WriteLine("PayloadType: " + src.PayloadType + ", " + dst.PayloadType); Console.WriteLine("SequenceNumber: " + src.SequenceNumber + ", " + dst.SequenceNumber); Console.WriteLine("Timestamp: " + src.Timestamp + ", " + dst.Timestamp); Console.WriteLine("SyncSource: " + src.SyncSource + ", " + dst.SyncSource); Console.WriteLine("Raw Header: " + System.Text.Encoding.ASCII.GetString(headerBuffer, 0, headerBuffer.Length)); Assert.IsTrue(src.Version == dst.Version, "Version was mismatched."); Assert.IsTrue(src.PaddingFlag == dst.PaddingFlag, "PaddingFlag was mismatched."); Assert.IsTrue(src.HeaderExtensionFlag == dst.HeaderExtensionFlag, "HeaderExtensionFlag was mismatched."); Assert.IsTrue(src.CSRCCount == dst.CSRCCount, "CSRCCount was mismatched."); Assert.IsTrue(src.MarkerBit == dst.MarkerBit, "MarkerBit was mismatched."); Assert.IsTrue(src.SequenceNumber == dst.SequenceNumber, "PayloadType was mismatched."); Assert.IsTrue(src.HeaderExtensionFlag == dst.HeaderExtensionFlag, "SequenceNumber was mismatched."); Assert.IsTrue(src.Timestamp == dst.Timestamp, "Timestamp was mismatched."); Assert.IsTrue(src.SyncSource == dst.SyncSource, "SyncSource was mismatched."); }
public void GetHeaderTest() { Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name); RTPHeader rtpHeader = new RTPHeader(); byte[] headerBuffer = rtpHeader.GetHeader(1, 0, 1); int byteNum = 1; foreach (byte headerByte in headerBuffer) { Console.WriteLine(byteNum + ": " + headerByte.ToString("x")); byteNum++; } }
public void CustomisedHeaderRoundTripTest() { logger.LogDebug("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name); logger.BeginScope(System.Reflection.MethodBase.GetCurrentMethod().Name); RTPHeader src = new RTPHeader(); src.Version = 3; src.PaddingFlag = 1; src.HeaderExtensionFlag = 1; src.MarkerBit = 1; src.CSRCCount = 3; src.PayloadType = (int)SDPMediaFormatsEnum.PCMA; byte[] headerBuffer = src.GetHeader(1, 0, 1); RTPHeader dst = new RTPHeader(headerBuffer); logger.LogDebug("Versions: " + src.Version + ", " + dst.Version); logger.LogDebug("PaddingFlag: " + src.PaddingFlag + ", " + dst.PaddingFlag); logger.LogDebug("HeaderExtensionFlag: " + src.HeaderExtensionFlag + ", " + dst.HeaderExtensionFlag); logger.LogDebug("CSRCCount: " + src.CSRCCount + ", " + dst.CSRCCount); logger.LogDebug("MarkerBit: " + src.MarkerBit + ", " + dst.MarkerBit); logger.LogDebug("PayloadType: " + src.PayloadType + ", " + dst.PayloadType); logger.LogDebug("SequenceNumber: " + src.SequenceNumber + ", " + dst.SequenceNumber); logger.LogDebug("Timestamp: " + src.Timestamp + ", " + dst.Timestamp); logger.LogDebug("SyncSource: " + src.SyncSource + ", " + dst.SyncSource); string rawHeader = null; foreach (byte headerByte in headerBuffer) { rawHeader += headerByte.ToString("x"); } logger.LogDebug("Raw Header: " + rawHeader); Assert.True(src.Version == dst.Version, "Version was mismatched."); Assert.True(src.PaddingFlag == dst.PaddingFlag, "PaddingFlag was mismatched."); Assert.True(src.HeaderExtensionFlag == dst.HeaderExtensionFlag, "HeaderExtensionFlag was mismatched."); Assert.True(src.CSRCCount == dst.CSRCCount, "CSRCCount was mismatched."); Assert.True(src.MarkerBit == dst.MarkerBit, "MarkerBit was mismatched."); Assert.True(src.SequenceNumber == dst.SequenceNumber, "PayloadType was mismatched."); Assert.True(src.HeaderExtensionFlag == dst.HeaderExtensionFlag, "SequenceNumber was mismatched."); Assert.True(src.Timestamp == dst.Timestamp, "Timestamp was mismatched."); Assert.True(src.SyncSource == dst.SyncSource, "SyncSource was mismatched."); }
public void GetHeaderTest() { logger.LogDebug("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name); logger.BeginScope(System.Reflection.MethodBase.GetCurrentMethod().Name); RTPHeader rtpHeader = new RTPHeader(); byte[] headerBuffer = rtpHeader.GetHeader(1, 0, 1); int byteNum = 1; foreach (byte headerByte in headerBuffer) { logger.LogDebug(byteNum + ": " + headerByte.ToString("x")); byteNum++; } }
public void CustomisedHeaderRoundTripTest() { Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name); RTPHeader src = new RTPHeader(); src.Version = 3; src.PaddingFlag = 1; src.HeaderExtensionFlag = 1; src.MarkerBit = 1; src.CSRCCount = 3; src.PayloadType = (int)RTPPayloadTypesEnum.GSM; byte[] headerBuffer = src.GetHeader(1, 0, 1); RTPHeader dst = new RTPHeader(headerBuffer); Console.WriteLine("Versions: " + src.Version + ", " + dst.Version); Console.WriteLine("PaddingFlag: " + src.PaddingFlag + ", " + dst.PaddingFlag); Console.WriteLine("HeaderExtensionFlag: " + src.HeaderExtensionFlag + ", " + dst.HeaderExtensionFlag); Console.WriteLine("CSRCCount: " + src.CSRCCount + ", " + dst.CSRCCount); Console.WriteLine("MarkerBit: " + src.MarkerBit + ", " + dst.MarkerBit); Console.WriteLine("PayloadType: " + src.PayloadType + ", " + dst.PayloadType); Console.WriteLine("SequenceNumber: " + src.SequenceNumber + ", " + dst.SequenceNumber); Console.WriteLine("Timestamp: " + src.Timestamp + ", " + dst.Timestamp); Console.WriteLine("SyncSource: " + src.SyncSource + ", " + dst.SyncSource); string rawHeader = null; foreach (byte headerByte in headerBuffer) { rawHeader += headerByte.ToString("x"); } Console.WriteLine("Raw Header: " + rawHeader); Assert.IsTrue(src.Version == dst.Version, "Version was mismatched."); Assert.IsTrue(src.PaddingFlag == dst.PaddingFlag, "PaddingFlag was mismatched."); Assert.IsTrue(src.HeaderExtensionFlag == dst.HeaderExtensionFlag, "HeaderExtensionFlag was mismatched."); Assert.IsTrue(src.CSRCCount == dst.CSRCCount, "CSRCCount was mismatched."); Assert.IsTrue(src.MarkerBit == dst.MarkerBit, "MarkerBit was mismatched."); Assert.IsTrue(src.SequenceNumber == dst.SequenceNumber, "PayloadType was mismatched."); Assert.IsTrue(src.HeaderExtensionFlag == dst.HeaderExtensionFlag, "SequenceNumber was mismatched."); Assert.IsTrue(src.Timestamp == dst.Timestamp, "Timestamp was mismatched."); Assert.IsTrue(src.SyncSource == dst.SyncSource, "SyncSource was mismatched."); }