summaryrefslogtreecommitdiff
path: root/chromium/third_party/webrtc/modules/audio_coding/neteq/rtp.h
blob: 4642eaef770a9b59db92beb7b9fc29bbec679c39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
 *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

/*
 * RTP data struct and related functions.
 */

#ifndef RTP_H
#define RTP_H

#include "typedefs.h"

#include "codec_db.h"

typedef struct
{
    uint16_t seqNumber;
    uint32_t timeStamp;
    uint32_t ssrc;
    int payloadType;
    const int16_t *payload;
    int16_t payloadLen;
    int16_t starts_byte1;
    int16_t rcuPlCntr;
} RTPPacket_t;

/****************************************************************************
 * WebRtcNetEQ_RTPPayloadInfo(...)
 *
 * Converts a datagram into an RTP header struct.
 *
 * Input:
 *		- Datagram		: UDP datagram from the network
 *		- DatagramLen	: Length in bytes of the datagram
 *
 * Output:
 *		- RTPheader		: Structure with the datagram info
 *
 * Return value			:  0 - Ok
 *						  -1 - Error
 */

int WebRtcNetEQ_RTPPayloadInfo(int16_t* pw16_Datagram, int i_DatagramLen,
                               RTPPacket_t* RTPheader);

/****************************************************************************
 * WebRtcNetEQ_RedundancySplit(...)
 *
 * Splits a Redundancy RTP struct into two RTP structs. User has to check 
 * that it's really the redundancy payload. No such check is done inside this
 * function.
 *
 * Input:
 *		- RTPheader		: First header holds the whole RTP packet (with the redundancy payload)
 *		- MaximumPayloads: 
 *						  The maximum number of RTP payloads that should be
 *						  extracted (1+maximum_no_of_Redundancies).
 *
 * Output:
 *		- RTPheader		: First header holds the main RTP data, while 2..N 
 *						  holds the redundancy data.
 *		- No_Of
 *
 * Return value			:  0 - Ok
 *						  -1 - Error
 */

int WebRtcNetEQ_RedundancySplit(RTPPacket_t* RTPheader[], int i_MaximumPayloads,
                                int *i_No_Of_Payloads);

#endif