niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | /* |
| 12 | * RTP data struct and related functions. |
| 13 | */ |
| 14 | |
| 15 | #ifndef RTP_H |
| 16 | #define RTP_H |
| 17 | |
| 18 | #include "typedefs.h" |
| 19 | |
| 20 | #include "codec_db.h" |
| 21 | |
| 22 | typedef struct |
| 23 | { |
pbos@webrtc.org | 0946a56 | 2013-04-09 00:28:06 +0000 | [diff] [blame] | 24 | uint16_t seqNumber; |
| 25 | uint32_t timeStamp; |
| 26 | uint32_t ssrc; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 27 | int payloadType; |
pbos@webrtc.org | 0946a56 | 2013-04-09 00:28:06 +0000 | [diff] [blame] | 28 | const int16_t *payload; |
| 29 | int16_t payloadLen; |
| 30 | int16_t starts_byte1; |
| 31 | int16_t rcuPlCntr; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 32 | } RTPPacket_t; |
| 33 | |
| 34 | /**************************************************************************** |
| 35 | * WebRtcNetEQ_RTPPayloadInfo(...) |
| 36 | * |
| 37 | * Converts a datagram into an RTP header struct. |
| 38 | * |
| 39 | * Input: |
| 40 | * - Datagram : UDP datagram from the network |
| 41 | * - DatagramLen : Length in bytes of the datagram |
| 42 | * |
| 43 | * Output: |
| 44 | * - RTPheader : Structure with the datagram info |
| 45 | * |
| 46 | * Return value : 0 - Ok |
| 47 | * -1 - Error |
| 48 | */ |
| 49 | |
pbos@webrtc.org | 0946a56 | 2013-04-09 00:28:06 +0000 | [diff] [blame] | 50 | int WebRtcNetEQ_RTPPayloadInfo(int16_t* pw16_Datagram, int i_DatagramLen, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 51 | RTPPacket_t* RTPheader); |
| 52 | |
| 53 | /**************************************************************************** |
| 54 | * WebRtcNetEQ_RedundancySplit(...) |
| 55 | * |
| 56 | * Splits a Redundancy RTP struct into two RTP structs. User has to check |
| 57 | * that it's really the redundancy payload. No such check is done inside this |
| 58 | * function. |
| 59 | * |
| 60 | * Input: |
| 61 | * - RTPheader : First header holds the whole RTP packet (with the redundancy payload) |
| 62 | * - MaximumPayloads: |
| 63 | * The maximum number of RTP payloads that should be |
| 64 | * extracted (1+maximum_no_of_Redundancies). |
| 65 | * |
| 66 | * Output: |
| 67 | * - RTPheader : First header holds the main RTP data, while 2..N |
| 68 | * holds the redundancy data. |
| 69 | * - No_Of |
| 70 | * |
| 71 | * Return value : 0 - Ok |
| 72 | * -1 - Error |
| 73 | */ |
| 74 | |
| 75 | int WebRtcNetEQ_RedundancySplit(RTPPacket_t* RTPheader[], int i_MaximumPayloads, |
| 76 | int *i_No_Of_Payloads); |
| 77 | |
| 78 | #endif |