ReportBlock.cs 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. Copyright (C) <2007-2016> <Kay Diefenthal>
  3. SatIp.RtspSample is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 3 of the License, or
  6. (at your option) any later version.
  7. SatIp.RtspSample is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with SatIp.RtspSample. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp.Rtcp
  15. {
  16. public class ReportBlock
  17. {
  18. /// <summary>
  19. /// Get the length of the block.
  20. /// </summary>
  21. public int BlockLength { get { return (24); } }
  22. /// <summary>
  23. /// Get the synchronization source.
  24. /// </summary>
  25. public string SynchronizationSource { get; private set; }
  26. /// <summary>
  27. /// Get the fraction lost.
  28. /// </summary>
  29. public int FractionLost { get; private set; }
  30. /// <summary>
  31. /// Get the cumulative packets lost.
  32. /// </summary>
  33. public int CumulativePacketsLost { get; private set; }
  34. /// <summary>
  35. /// Get the highest number received.
  36. /// </summary>
  37. public int HighestNumberReceived { get; private set; }
  38. /// <summary>
  39. /// Get the inter arrival jitter.
  40. /// </summary>
  41. public int InterArrivalJitter { get; private set; }
  42. /// <summary>
  43. /// Get the timestamp of the last report.
  44. /// </summary>
  45. public int LastReportTimeStamp { get; private set; }
  46. /// <summary>
  47. /// Get the delay since the last report.
  48. /// </summary>
  49. public int DelaySinceLastReport { get; private set; }
  50. /// <summary>
  51. /// Initialize a new instance of the ReportBlock class.
  52. /// </summary>
  53. public ReportBlock() { }
  54. /// <summary>
  55. /// Unpack the data in a packet.
  56. /// </summary>
  57. /// <param name="buffer">The buffer containing the packet.</param>
  58. /// <param name="offset">The offset to the first byte of the packet within the buffer.</param>
  59. /// <returns>An ErrorSpec instance if an error occurs; null otherwise.</returns>
  60. public void Process(byte[] buffer, int offset)
  61. {
  62. SynchronizationSource = Utils.ConvertBytesToString(buffer, offset, 4);
  63. FractionLost = buffer[offset + 4];
  64. CumulativePacketsLost = Utils.Convert3BytesToInt(buffer, offset + 5);
  65. HighestNumberReceived = Utils.Convert4BytesToInt(buffer, offset + 8);
  66. InterArrivalJitter = Utils.Convert4BytesToInt(buffer, offset + 12);
  67. LastReportTimeStamp = Utils.Convert4BytesToInt(buffer, offset + 16);
  68. DelaySinceLastReport = Utils.Convert4BytesToInt(buffer, offset + 20);
  69. }
  70. }
  71. }