接收Nack的调用栈

image.png
image.png

Call::DeliverPacket

image.png

RTCP包的判断

image.png

  1. H:\webrtc-20210315\webrtc-20210315\webrtc\webrtc-checkout\src\call\call.cc
  2. bool IsRtcp(const uint8_t* packet, size_t length) {
  3. RtpUtility::RtpHeaderParser rtp_parser(packet, length);
  4. return rtp_parser.RTCP();
  5. }
  6. H:\webrtc-20210315\webrtc-20210315\webrtc\webrtc-checkout\src\modules\rtp_rtcp\source\rtp_utility.cc
  7. bool RtpHeaderParser::RTCP() const {
  8. // 72 to 76 is reserved for RTP
  9. // 77 to 79 is not reserver but they are not assigned we will block them
  10. // for RTCP 200 SR == marker bit + 72
  11. // for RTCP 204 APP == marker bit + 76
  12. /*
  13. * RTCP
  14. *
  15. * FIR full INTRA-frame request 192 [RFC2032] supported
  16. * NACK negative acknowledgement 193 [RFC2032]
  17. * IJ Extended inter-arrival jitter report 195 [RFC-ietf-avt-rtp-toff
  18. * set-07.txt] http://tools.ietf.org/html/draft-ietf-avt-rtp-toffset-07
  19. * SR sender report 200 [RFC3551] supported
  20. * RR receiver report 201 [RFC3551] supported
  21. * SDES source description 202 [RFC3551] supported
  22. * BYE goodbye 203 [RFC3551] supported
  23. * APP application-defined 204 [RFC3551] ignored
  24. * RTPFB Transport layer FB message 205 [RFC4585] supported
  25. * PSFB Payload-specific FB message 206 [RFC4585] supported
  26. * XR extended report 207 [RFC3611] supported
  27. */
  28. /* 205 RFC 5104
  29. * FMT 1 NACK supported
  30. * FMT 2 reserved
  31. * FMT 3 TMMBR supported
  32. * FMT 4 TMMBN supported
  33. */
  34. /* 206 RFC 5104
  35. * FMT 1: Picture Loss Indication (PLI) supported
  36. * FMT 2: Slice Lost Indication (SLI)
  37. * FMT 3: Reference Picture Selection Indication (RPSI)
  38. * FMT 4: Full Intra Request (FIR) Command supported
  39. * FMT 5: Temporal-Spatial Trade-off Request (TSTR)
  40. * FMT 6: Temporal-Spatial Trade-off Notification (TSTN)
  41. * FMT 7: Video Back Channel Message (VBCM)
  42. * FMT 15: Application layer FB message
  43. */
  44. const ptrdiff_t length = _ptrRTPDataEnd - _ptrRTPDataBegin;
  45. if (length < kRtcpMinHeaderLength) {
  46. return false;
  47. }
  48. const uint8_t V = _ptrRTPDataBegin[0] >> 6;
  49. if (V != kRtcpExpectedVersion) {
  50. return false;
  51. }
  52. const uint8_t payloadType = _ptrRTPDataBegin[1];
  53. switch (payloadType) {
  54. case 192:
  55. return true;
  56. case 193:
  57. // not supported
  58. // pass through and check for a potential RTP packet
  59. return false;
  60. case 195:
  61. case 200:
  62. case 201:
  63. case 202:
  64. case 203:
  65. case 204:
  66. case 205:
  67. case 206:
  68. case 207:
  69. return true;
  70. default:
  71. return false;
  72. }
  73. }

RTCPReceiver::IncomingPacket

image.png
ParseCompoundPacket 解析联合包, 联合包就是将多个rtcp包组合起来为一个UDP包发送出去。
多个RTCP包如何解析? 通过解析每一个包的长度来,找到长度后,拿出该长度的内容解析出该包。

ParseCompoundPacket

image.png

PacketInformation

image.png