mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-14 14:20:45 +01:00

In https://webrtc-review.googlesource.com/c/src/+/1560 we moved WebRTC from src/webrtc to src/ (in order to preserve an healthy git history). This CL takes care of fixing header guards, #include paths, etc... NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true TBR=tommi@webrtc.org Bug: chromium:611808 Change-Id: Iea91618212bee0af16aa3f05071eab8f93706578 Reviewed-on: https://webrtc-review.googlesource.com/1561 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Henrik Kjellander <kjellander@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#19846}
104 lines
3.3 KiB
C++
104 lines
3.3 KiB
C++
/*
|
|
* Copyright (c) 2012 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.
|
|
*/
|
|
|
|
#ifndef NETEQTEST_RTPPACKET_H
|
|
#define NETEQTEST_RTPPACKET_H
|
|
|
|
#include <map>
|
|
#include <stdio.h>
|
|
#include "typedefs.h"
|
|
#include "modules/include/module_common_types.h"
|
|
|
|
enum stereoModes {
|
|
stereoModeMono,
|
|
stereoModeSample1,
|
|
stereoModeSample2,
|
|
stereoModeFrame,
|
|
stereoModeDuplicate
|
|
};
|
|
|
|
class NETEQTEST_RTPpacket
|
|
{
|
|
public:
|
|
NETEQTEST_RTPpacket();
|
|
bool operator !() const { return (dataLen() < 0); };
|
|
virtual ~NETEQTEST_RTPpacket();
|
|
void reset();
|
|
static int skipFileHeader(FILE *fp);
|
|
virtual int readFromFile(FILE *fp);
|
|
int readFixedFromFile(FILE *fp, size_t len);
|
|
virtual int writeToFile(FILE *fp);
|
|
void blockPT(uint8_t pt);
|
|
virtual void parseHeader();
|
|
void parseHeader(webrtc::WebRtcRTPHeader* rtp_header);
|
|
const webrtc::WebRtcRTPHeader* RTPinfo() const;
|
|
uint8_t * datagram() const;
|
|
uint8_t * payload() const;
|
|
size_t payloadLen();
|
|
int16_t dataLen() const;
|
|
bool isParsed() const;
|
|
bool isLost() const;
|
|
uint32_t time() const { return _receiveTime; };
|
|
|
|
uint8_t payloadType() const;
|
|
uint16_t sequenceNumber() const;
|
|
uint32_t timeStamp() const;
|
|
uint32_t SSRC() const;
|
|
uint8_t markerBit() const;
|
|
|
|
int setPayloadType(uint8_t pt);
|
|
int setSequenceNumber(uint16_t sn);
|
|
int setTimeStamp(uint32_t ts);
|
|
int setSSRC(uint32_t ssrc);
|
|
int setMarkerBit(uint8_t mb);
|
|
void setTime(uint32_t receiveTime) { _receiveTime = receiveTime; };
|
|
|
|
int setRTPheader(const webrtc::WebRtcRTPHeader* RTPinfo);
|
|
|
|
int splitStereo(NETEQTEST_RTPpacket* slaveRtp, enum stereoModes mode);
|
|
|
|
int extractRED(int index, webrtc::WebRtcRTPHeader& red);
|
|
|
|
void scramblePayload(void);
|
|
|
|
uint8_t * _datagram;
|
|
uint8_t * _payloadPtr;
|
|
int _memSize;
|
|
int16_t _datagramLen;
|
|
size_t _payloadLen;
|
|
webrtc::WebRtcRTPHeader _rtpInfo;
|
|
bool _rtpParsed;
|
|
uint32_t _receiveTime;
|
|
bool _lost;
|
|
std::map<uint8_t, bool> _blockList;
|
|
|
|
protected:
|
|
static const int _kRDHeaderLen;
|
|
static const int _kBasicHeaderLen;
|
|
|
|
void parseBasicHeader(webrtc::WebRtcRTPHeader* RTPinfo, int *i_P, int *i_X,
|
|
int *i_CC) const;
|
|
int calcHeaderLength(int i_X, int i_CC) const;
|
|
|
|
private:
|
|
void makeRTPheader(unsigned char* rtp_data, uint8_t payloadType,
|
|
uint16_t seqNo, uint32_t timestamp,
|
|
uint32_t ssrc, uint8_t markerBit) const;
|
|
uint16_t parseRTPheader(webrtc::WebRtcRTPHeader* RTPinfo,
|
|
uint8_t **payloadPtr = NULL) const;
|
|
uint16_t parseRTPheader(uint8_t **payloadPtr = NULL)
|
|
{ return parseRTPheader(&_rtpInfo, payloadPtr);};
|
|
int calcPadLength(int i_P) const;
|
|
void splitStereoSample(NETEQTEST_RTPpacket* slaveRtp, int stride);
|
|
void splitStereoFrame(NETEQTEST_RTPpacket* slaveRtp);
|
|
void splitStereoDouble(NETEQTEST_RTPpacket* slaveRtp);
|
|
};
|
|
|
|
#endif //NETEQTEST_RTPPACKET_H
|