OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 12 matching lines...) Expand all Loading... |
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 #ifndef TALK_MEDIA_BASE_RTPUTILS_H_ | 28 #ifndef TALK_MEDIA_BASE_RTPUTILS_H_ |
29 #define TALK_MEDIA_BASE_RTPUTILS_H_ | 29 #define TALK_MEDIA_BASE_RTPUTILS_H_ |
30 | 30 |
31 #include "webrtc/base/byteorder.h" | 31 #include "webrtc/base/byteorder.h" |
32 | 32 |
| 33 namespace rtc { |
| 34 struct PacketTimeUpdateParams; |
| 35 } // namespace rtc |
| 36 |
33 namespace cricket { | 37 namespace cricket { |
34 | 38 |
35 const size_t kMinRtpPacketLen = 12; | 39 const size_t kMinRtpPacketLen = 12; |
36 const size_t kMaxRtpPacketLen = 2048; | 40 const size_t kMaxRtpPacketLen = 2048; |
37 const size_t kMinRtcpPacketLen = 4; | 41 const size_t kMinRtcpPacketLen = 4; |
38 | 42 |
39 struct RtpHeader { | 43 struct RtpHeader { |
40 int payload_type; | 44 int payload_type; |
41 int seq_num; | 45 int seq_num; |
42 uint32_t timestamp; | 46 uint32_t timestamp; |
(...skipping 21 matching lines...) Expand all Loading... |
64 | 68 |
65 bool SetRtpSsrc(void* data, size_t len, uint32_t value); | 69 bool SetRtpSsrc(void* data, size_t len, uint32_t value); |
66 // Assumes version 2, no padding, no extensions, no csrcs. | 70 // Assumes version 2, no padding, no extensions, no csrcs. |
67 bool SetRtpHeader(void* data, size_t len, const RtpHeader& header); | 71 bool SetRtpHeader(void* data, size_t len, const RtpHeader& header); |
68 | 72 |
69 bool IsRtpPacket(const void* data, size_t len); | 73 bool IsRtpPacket(const void* data, size_t len); |
70 | 74 |
71 // True if |payload type| is 0-127. | 75 // True if |payload type| is 0-127. |
72 bool IsValidRtpPayloadType(int payload_type); | 76 bool IsValidRtpPayloadType(int payload_type); |
73 | 77 |
| 78 // Verifies that a packet has a valid RTP header. |
| 79 bool ValidateRtpHeader(const uint8_t* rtp, |
| 80 size_t length, |
| 81 size_t* header_length); |
| 82 |
| 83 // Helper method which updates the absolute send time extension if present. |
| 84 bool UpdateRtpAbsSendTimeExtension(uint8_t* rtp, |
| 85 size_t length, |
| 86 int extension_id, |
| 87 uint64_t time_us); |
| 88 |
| 89 // Applies specified |options| to the packet. It updates the absolute send time |
| 90 // extension header if it is present present then updates HMAC. |
| 91 bool ApplyPacketOptions(uint8_t* data, |
| 92 size_t length, |
| 93 const rtc::PacketTimeUpdateParams& packet_time_params, |
| 94 uint64_t time_us); |
| 95 |
| 96 |
74 } // namespace cricket | 97 } // namespace cricket |
75 | 98 |
76 #endif // TALK_MEDIA_BASE_RTPUTILS_H_ | 99 #endif // TALK_MEDIA_BASE_RTPUTILS_H_ |
OLD | NEW |