Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

53 рядки
1.4KB

  1. /// RFC2250 2. Encapsulation of MPEG System and Transport Streams (p3)
  2. #include "rtp-packet.h"
  3. #include "rtp-payload-helper.h"
  4. #include "rtp-payload-internal.h"
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <string.h>
  8. #include <assert.h>
  9. #include <errno.h>
  10. static int rtp_decode_ts(void* p, const void* packet, int bytes)
  11. {
  12. struct rtp_packet_t pkt;
  13. struct rtp_payload_helper_t *helper;
  14. helper = (struct rtp_payload_helper_t *)p;
  15. if (!helper || 0 != rtp_packet_deserialize(&pkt, packet, bytes))
  16. return -EINVAL;
  17. rtp_payload_check(helper, &pkt);
  18. // 2.1 RTP header usage(p4)
  19. // M bit: Set to 1 whenever the timestamp is discontinuous. (such as
  20. // might happen when a sender switches from one data
  21. // source to another).This allows the receiver and any
  22. // intervening RTP mixers or translators that are synchronizing
  23. // to the flow to ignore the difference between this timestamp
  24. // and any previous timestamp in their clock phase detectors.
  25. if (pkt.rtp.m)
  26. {
  27. //TODO: test
  28. // new frame start
  29. //helper->size = 0; // discard previous packets
  30. helper->lost = 1; // notify source changed
  31. rtp_payload_onframe(helper); // clear previous source data
  32. }
  33. rtp_payload_write(helper, &pkt);
  34. return helper->lost ? 0 : 1; // packet handled
  35. }
  36. struct rtp_payload_decode_t *rtp_ts_decode()
  37. {
  38. static struct rtp_payload_decode_t decode = {
  39. rtp_payload_helper_create,
  40. rtp_payload_helper_destroy,
  41. rtp_decode_ts,
  42. };
  43. return &decode;
  44. }