Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

65 строки
2.3KB

  1. #include "rtp-ext.h"
  2. #include <inttypes.h>
  3. #include <stdint.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <assert.h>
  7. #include <stdio.h>
  8. int rtp_ext_string_parse(const uint8_t* data, int bytes, char* v, int n)
  9. {
  10. if (n < bytes + 1)
  11. return -1;
  12. memcpy(v, data, bytes);
  13. v[bytes] = 0;
  14. return 0;
  15. }
  16. int rtp_ext_string_write(uint8_t* data, int bytes, const char* v, int n)
  17. {
  18. if (bytes < n)
  19. return -1;
  20. memcpy(data, v, n);
  21. return n;
  22. }
  23. // https://datatracker.ietf.org/doc/html/rfc8843#section-15.1
  24. /*
  25. 0 1 2 3
  26. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  27. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  28. | MID=15 | length | identification-tag ...
  29. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  30. */
  31. //int rtp_ext_sdes_mid_parse(const uint8_t* data, int bytes, const char* mid, int len)
  32. //{
  33. // return rtp_ext_string_parse(data, bytes, mid, len);
  34. //}
  35. // https://datatracker.ietf.org/doc/html/rfc8852#section-4
  36. // 1. RtpStreamId and RepairedRtpStreamId are limited to a total of 255 octets in length.
  37. // 2. RtpStreamId and RepairedRtpStreamId are constrained to contain only alphanumeric characters.
  38. // For avoidance of doubt, the only allowed byte values for these IDs are decimal 48 through 57, 65 through 90, and 97 through 122.
  39. /*
  40. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  41. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  42. |RtpStreamId=12 | length | RtpStreamId ...
  43. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  44. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  45. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  46. |Repaired...=13 | length | RepairRtpStreamId ...
  47. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  48. */
  49. //int rtp_ext_sdes_rtp_stream_id(const uint8_t* data, int bytes, char* id, int len)
  50. //{
  51. // return rtp_ext_string_parse(data, bytes, id, len);
  52. //}
  53. //
  54. //int rtp_ext_sdes_repaired_rtp_stream_id(const uint8_t* data, int bytes, char* id, int len)
  55. //{
  56. // return rtp_ext_string_parse(data, bytes, id, len);
  57. //}