Note: We no longer publish the latest version of our code here. We primarily use a kumc-bmi github organization. The heron ETL repository, in particular, is not public. Peers in the informatics community should see MultiSiteDev for details on requesting access.

source: webrtc/webrtc/modules/audio_coding/neteq4/test/NETEQTEST_RTPpacket.h @ 0:4bda6873e34c

pub_scrub_3792 tip
Last change on this file since 0:4bda6873e34c was 0:4bda6873e34c, checked in by Michael Prittie <mprittie@…>, 6 years ago

Scrubbed password for publication.

File size: 3.4 KB
Line 
1/*
2 *  Copyright (c) 2012 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#ifndef NETEQTEST_RTPPACKET_H
12#define NETEQTEST_RTPPACKET_H
13
14#include <map>
15#include <stdio.h>
16#include "webrtc/typedefs.h"
17#include "webrtc/modules/interface/module_common_types.h"
18
19enum stereoModes {
20    stereoModeMono,
21    stereoModeSample1,
22    stereoModeSample2,
23    stereoModeFrame,
24    stereoModeDuplicate
25};
26
27class NETEQTEST_RTPpacket
28{
29public:
30    NETEQTEST_RTPpacket();
31    bool operator !() const { return (dataLen() < 0); };
32    virtual ~NETEQTEST_RTPpacket();
33    void reset();
34    static int skipFileHeader(FILE *fp);
35    virtual int readFromFile(FILE *fp);
36    int readFixedFromFile(FILE *fp, size_t len);
37    virtual int writeToFile(FILE *fp);
38    void blockPT(uint8_t pt);
39    //int16_t payloadType();
40    void parseHeader();
41    void parseHeader(webrtc::WebRtcRTPHeader* rtp_header);
42    const webrtc::WebRtcRTPHeader* RTPinfo() const;
43    uint8_t * datagram() const;
44    uint8_t * payload() const;
45    int16_t payloadLen();
46    int16_t dataLen() const;
47    bool isParsed() const;
48    bool isLost() const;
49    uint32_t time() const { return _receiveTime; };
50
51    uint8_t  payloadType() const;
52    uint16_t sequenceNumber() const;
53    uint32_t timeStamp() const;
54    uint32_t SSRC() const;
55    uint8_t  markerBit() const;
56
57    int setPayloadType(uint8_t pt);
58    int setSequenceNumber(uint16_t sn);
59    int setTimeStamp(uint32_t ts);
60    int setSSRC(uint32_t ssrc);
61    int setMarkerBit(uint8_t mb);
62    void setTime(uint32_t receiveTime) { _receiveTime = receiveTime; };
63
64    int setRTPheader(const webrtc::WebRtcRTPHeader* RTPinfo);
65
66    int splitStereo(NETEQTEST_RTPpacket* slaveRtp, enum stereoModes mode);
67
68    int extractRED(int index, webrtc::WebRtcRTPHeader& red);
69
70    void scramblePayload(void);
71
72    uint8_t *       _datagram;
73    uint8_t *       _payloadPtr;
74    int                 _memSize;
75    int16_t         _datagramLen;
76    int16_t         _payloadLen;
77    webrtc::WebRtcRTPHeader _rtpInfo;
78    bool                _rtpParsed;
79    uint32_t        _receiveTime;
80    bool                _lost;
81    std::map<uint8_t, bool> _blockList;
82
83protected:
84    static const int _kRDHeaderLen;
85    static const int _kBasicHeaderLen;
86
87    void parseBasicHeader(webrtc::WebRtcRTPHeader* RTPinfo, int *i_P, int *i_X,
88                          int *i_CC) const;
89    int calcHeaderLength(int i_X, int i_CC) const;
90
91private:
92    void makeRTPheader(unsigned char* rtp_data, uint8_t payloadType,
93                       uint16_t seqNo, uint32_t timestamp,
94                       uint32_t ssrc, uint8_t markerBit) const;
95    uint16_t parseRTPheader(webrtc::WebRtcRTPHeader* RTPinfo,
96                            uint8_t **payloadPtr = NULL) const;
97    uint16_t parseRTPheader(uint8_t **payloadPtr = NULL)
98        { return parseRTPheader(&_rtpInfo, payloadPtr);};
99    int calcPadLength(int i_P) const;
100    void splitStereoSample(NETEQTEST_RTPpacket* slaveRtp, int stride);
101    void splitStereoFrame(NETEQTEST_RTPpacket* slaveRtp);
102    void splitStereoDouble(NETEQTEST_RTPpacket* slaveRtp);
103};
104
105#endif //NETEQTEST_RTPPACKET_H
Note: See TracBrowser for help on using the repository browser.