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/neteq/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 "typedefs.h"
17#include "webrtc_neteq_internal.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    void selectSSRC(uint32_t ssrc);
40    //int16_t payloadType();
41    void parseHeader();
42    void parseHeader(WebRtcNetEQ_RTPInfo & rtpInfo);
43    WebRtcNetEQ_RTPInfo const * RTPinfo() const;
44    uint8_t * datagram() const;
45    uint8_t * payload() const;
46    int16_t payloadLen();
47    int16_t dataLen() const;
48    bool isParsed() const;
49    bool isLost() const;
50    uint32_t time() const { return _receiveTime; };
51
52    uint8_t  payloadType() const;
53    uint16_t sequenceNumber() const;
54    uint32_t timeStamp() const;
55    uint32_t SSRC() const;
56    uint8_t  markerBit() const;
57
58    int setPayloadType(uint8_t pt);
59    int setSequenceNumber(uint16_t sn);
60    int setTimeStamp(uint32_t ts);
61    int setSSRC(uint32_t ssrc);
62    int setMarkerBit(uint8_t mb);
63    void setTime(uint32_t receiveTime) { _receiveTime = receiveTime; };
64
65    int setRTPheader(const WebRtcNetEQ_RTPInfo *RTPinfo);
66
67    int splitStereo(NETEQTEST_RTPpacket* slaveRtp, enum stereoModes mode);
68
69    int extractRED(int index, WebRtcNetEQ_RTPInfo& red);
70
71    void scramblePayload(void);
72
73    uint8_t *       _datagram;
74    uint8_t *       _payloadPtr;
75    int                 _memSize;
76    int16_t         _datagramLen;
77    int16_t         _payloadLen;
78    WebRtcNetEQ_RTPInfo  _rtpInfo;
79    bool                _rtpParsed;
80    uint32_t        _receiveTime;
81    bool                _lost;
82    std::map<uint8_t, bool> _blockList;
83    uint32_t            _selectSSRC;
84    bool                _filterSSRC;
85
86protected:
87    static const int _kRDHeaderLen;
88    static const int _kBasicHeaderLen;
89
90    void parseBasicHeader(WebRtcNetEQ_RTPInfo *RTPinfo, int *i_P, int *i_X,
91                          int *i_CC) const;
92    int calcHeaderLength(int i_X, int i_CC) const;
93
94private:
95    void makeRTPheader(unsigned char* rtp_data, uint8_t payloadType,
96                       uint16_t seqNo, uint32_t timestamp,
97                       uint32_t ssrc, uint8_t markerBit) const;
98    uint16_t parseRTPheader(WebRtcNetEQ_RTPInfo *RTPinfo,
99                            uint8_t **payloadPtr = NULL) const;
100    uint16_t parseRTPheader(uint8_t **payloadPtr = NULL)
101        { return parseRTPheader(&_rtpInfo, payloadPtr);};
102    int calcPadLength(int i_P) const;
103    void splitStereoSample(NETEQTEST_RTPpacket* slaveRtp, int stride);
104    void splitStereoFrame(NETEQTEST_RTPpacket* slaveRtp);
105    void splitStereoDouble(NETEQTEST_RTPpacket* slaveRtp);
106};
107
108#endif //NETEQTEST_RTPPACKET_H
Note: See TracBrowser for help on using the repository browser.