修复拼写错误

This commit is contained in:
xiongziliang 2020-05-25 13:51:00 +08:00
parent 06d61cf195
commit 893564d0be
21 changed files with 89 additions and 89 deletions

View File

@ -173,21 +173,21 @@ public:
*
* @param aac_cfg aac两个字节的配置描述
* @param sample_rate
* @param playload_type rtp playload type 98
* @param payload_type rtp payload type 98
* @param bitrate
*/
AACSdp(const string &aac_cfg,
int sample_rate,
int channels,
int playload_type = 98,
int bitrate = 128) : Sdp(sample_rate,playload_type){
_printer << "m=audio 0 RTP/AVP " << playload_type << "\r\n";
int payload_type = 98,
int bitrate = 128) : Sdp(sample_rate,payload_type){
_printer << "m=audio 0 RTP/AVP " << payload_type << "\r\n";
_printer << "b=AS:" << bitrate << "\r\n";
_printer << "a=rtpmap:" << playload_type << " MPEG4-GENERIC/" << sample_rate << "/" << channels << "\r\n";
_printer << "a=rtpmap:" << payload_type << " MPEG4-GENERIC/" << sample_rate << "/" << channels << "\r\n";
char configStr[32] = {0};
snprintf(configStr, sizeof(configStr), "%02X%02X", (uint8_t)aac_cfg[0], (uint8_t)aac_cfg[1]);
_printer << "a=fmtp:" << playload_type << " streamtype=5;profile-level-id=1;mode=AAC-hbr;"
_printer << "a=fmtp:" << payload_type << " streamtype=5;profile-level-id=1;mode=AAC-hbr;"
<< "sizelength=13;indexlength=3;indexdeltalength=3;config=" << configStr << "\r\n";
_printer << "a=control:trackID=" << (int)TrackAudio << "\r\n";
}

View File

@ -16,12 +16,12 @@ namespace mediakit{
AACRtpEncoder::AACRtpEncoder(uint32_t ui32Ssrc,
uint32_t ui32MtuSize,
uint32_t ui32SampleRate,
uint8_t ui8PlayloadType,
uint8_t ui8PayloadType,
uint8_t ui8Interleaved) :
RtpInfo(ui32Ssrc,
ui32MtuSize,
ui32SampleRate,
ui8PlayloadType,
ui8PayloadType,
ui8Interleaved){
}

View File

@ -56,13 +56,13 @@ public:
* @param ui32Ssrc ssrc
* @param ui32MtuSize mtu
* @param ui32SampleRate
* @param ui8PlayloadType pt类型
* @param ui8PayloadType pt类型
* @param ui8Interleaved rtsp interleaved
*/
AACRtpEncoder(uint32_t ui32Ssrc,
uint32_t ui32MtuSize,
uint32_t ui32SampleRate,
uint8_t ui8PlayloadType = 97,
uint8_t ui8PayloadType = 97,
uint8_t ui8Interleaved = TrackAudio * 2);
~AACRtpEncoder() {}

View File

@ -115,7 +115,7 @@ RtpCodec::Ptr Factory::getRtpEncoderBySdp(const Sdp::Ptr &sdp) {
}
auto mtu = (sdp->getTrackType() == TrackVideo ? video_mtu : audio_mtu);
auto sample_rate = sdp->getSampleRate();
auto pt = sdp->getPlayloadType();
auto pt = sdp->getPayloadType();
auto interleaved = sdp->getTrackType() * 2;
auto codec_id = sdp->getCodecId();
switch (codec_id){

View File

@ -83,16 +83,16 @@ public:
* G711采样率固定为8000
* @param codecId G711A G711U
* @param sample_rate
* @param playload_type rtp playload
* @param payload_type rtp payload
* @param bitrate
*/
G711Sdp(CodecId codecId,
int sample_rate,
int channels,
int playload_type = 98,
int bitrate = 128) : Sdp(sample_rate,playload_type), _codecId(codecId){
_printer << "m=audio 0 RTP/AVP " << playload_type << "\r\n";
_printer << "a=rtpmap:" << playload_type << (codecId == CodecG711A ? " PCMA/" : " PCMU/") << sample_rate << "/" << channels << "\r\n";
int payload_type = 98,
int bitrate = 128) : Sdp(sample_rate,payload_type), _codecId(codecId){
_printer << "m=audio 0 RTP/AVP " << payload_type << "\r\n";
_printer << "a=rtpmap:" << payload_type << (codecId == CodecG711A ? " PCMA/" : " PCMU/") << sample_rate << "/" << channels << "\r\n";
_printer << "a=control:trackID=" << (int)TrackAudio << "\r\n";
}

View File

@ -62,12 +62,12 @@ void G711RtpDecoder::onGetG711(const G711Frame::Ptr &frame) {
G711RtpEncoder::G711RtpEncoder(uint32_t ui32Ssrc,
uint32_t ui32MtuSize,
uint32_t ui32SampleRate,
uint8_t ui8PlayloadType,
uint8_t ui8PayloadType,
uint8_t ui8Interleaved) :
RtpInfo(ui32Ssrc,
ui32MtuSize,
ui32SampleRate,
ui8PlayloadType,
ui8PayloadType,
ui8Interleaved) {
}

View File

@ -58,13 +58,13 @@ public:
* @param ui32Ssrc ssrc
* @param ui32MtuSize mtu
* @param ui32SampleRate
* @param ui8PlayloadType pt类型
* @param ui8PayloadType pt类型
* @param ui8Interleaved rtsp interleaved
*/
G711RtpEncoder(uint32_t ui32Ssrc,
uint32_t ui32MtuSize,
uint32_t ui32SampleRate,
uint8_t ui8PlayloadType = 0,
uint8_t ui8PayloadType = 0,
uint8_t ui8Interleaved = TrackAudio * 2);
~G711RtpEncoder() {}

View File

@ -289,18 +289,18 @@ public:
*
* @param sps 264 sps,0x00000001
* @param pps 264 pps,0x00000001
* @param playload_type rtp playload type 96
* @param payload_type rtp payload type 96
* @param bitrate
*/
H264Sdp(const string &strSPS,
const string &strPPS,
int playload_type = 96,
int bitrate = 4000) : Sdp(90000,playload_type) {
int payload_type = 96,
int bitrate = 4000) : Sdp(90000,payload_type) {
//视频通道
_printer << "m=video 0 RTP/AVP " << playload_type << "\r\n";
_printer << "m=video 0 RTP/AVP " << payload_type << "\r\n";
_printer << "b=AS:" << bitrate << "\r\n";
_printer << "a=rtpmap:" << playload_type << " H264/" << 90000 << "\r\n";
_printer << "a=fmtp:" << playload_type << " packetization-mode=1; profile-level-id=";
_printer << "a=rtpmap:" << payload_type << " H264/" << 90000 << "\r\n";
_printer << "a=fmtp:" << payload_type << " packetization-mode=1; profile-level-id=";
char strTemp[100];
uint32_t profile_level_id = 0;

View File

@ -204,12 +204,12 @@ void H264RtpDecoder::onGetH264(const H264Frame::Ptr &frame) {
H264RtpEncoder::H264RtpEncoder(uint32_t ui32Ssrc,
uint32_t ui32MtuSize,
uint32_t ui32SampleRate,
uint8_t ui8PlayloadType,
uint8_t ui8PayloadType,
uint8_t ui8Interleaved) :
RtpInfo(ui32Ssrc,
ui32MtuSize,
ui32SampleRate,
ui8PlayloadType,
ui8PayloadType,
ui8Interleaved) {
}

View File

@ -62,13 +62,13 @@ public:
* @param ui32Ssrc ssrc
* @param ui32MtuSize mtu大小
* @param ui32SampleRate 90000
* @param ui8PlayloadType pt类型
* @param ui8PayloadType pt类型
* @param ui8Interleaved rtsp interleaved
*/
H264RtpEncoder(uint32_t ui32Ssrc,
uint32_t ui32MtuSize = 1400,
uint32_t ui32SampleRate = 90000,
uint8_t ui8PlayloadType = 96,
uint8_t ui8PayloadType = 96,
uint8_t ui8Interleaved = TrackVideo * 2);
~H264RtpEncoder() {}

View File

@ -315,19 +315,19 @@ public:
*
* @param sps 265 sps,0x00000001
* @param pps 265 pps,0x00000001
* @param playload_type rtp playload type 96
* @param payload_type rtp payload type 96
* @param bitrate
*/
H265Sdp(const string &strVPS,
const string &strSPS,
const string &strPPS,
int playload_type = 96,
int bitrate = 4000) : Sdp(90000,playload_type) {
int payload_type = 96,
int bitrate = 4000) : Sdp(90000,payload_type) {
//视频通道
_printer << "m=video 0 RTP/AVP " << playload_type << "\r\n";
_printer << "m=video 0 RTP/AVP " << payload_type << "\r\n";
_printer << "b=AS:" << bitrate << "\r\n";
_printer << "a=rtpmap:" << playload_type << " H265/" << 90000 << "\r\n";
_printer << "a=fmtp:" << playload_type << " ";
_printer << "a=rtpmap:" << payload_type << " H265/" << 90000 << "\r\n";
_printer << "a=fmtp:" << payload_type << " ";
_printer << "sprop-vps=";
_printer << encodeBase64(strVPS) << "; ";
_printer << "sprop-sps=";

View File

@ -140,12 +140,12 @@ void H265RtpDecoder::onGetH265(const H265Frame::Ptr &frame) {
H265RtpEncoder::H265RtpEncoder(uint32_t ui32Ssrc,
uint32_t ui32MtuSize,
uint32_t ui32SampleRate,
uint8_t ui8PlayloadType,
uint8_t ui8PayloadType,
uint8_t ui8Interleaved) :
RtpInfo(ui32Ssrc,
ui32MtuSize,
ui32SampleRate,
ui8PlayloadType,
ui8PayloadType,
ui8Interleaved) {
}

View File

@ -63,13 +63,13 @@ public:
* @param ui32Ssrc ssrc
* @param ui32MtuSize mtu大小
* @param ui32SampleRate 90000
* @param ui8PlayloadType pt类型
* @param ui8PayloadType pt类型
* @param ui8Interleaved rtsp interleaved
*/
H265RtpEncoder(uint32_t ui32Ssrc,
uint32_t ui32MtuSize = 1400,
uint32_t ui32SampleRate = 90000,
uint8_t ui8PlayloadType = 96,
uint8_t ui8PayloadType = 96,
uint8_t ui8Interleaved = TrackVideo * 2);
~H265RtpEncoder() {}

View File

@ -80,15 +80,15 @@ public:
/**
* opus sdp
* @param sample_rate
* @param playload_type rtp playload
* @param payload_type rtp payload
* @param bitrate
*/
OpusSdp(int sample_rate,
int channels,
int playload_type = 98,
int bitrate = 128) : Sdp(sample_rate,playload_type){
_printer << "m=audio 0 RTP/AVP " << playload_type << "\r\n";
_printer << "a=rtpmap:" << playload_type << " opus/" << sample_rate << "/" << channels << "\r\n";
int payload_type = 98,
int bitrate = 128) : Sdp(sample_rate,payload_type){
_printer << "m=audio 0 RTP/AVP " << payload_type << "\r\n";
_printer << "a=rtpmap:" << payload_type << " opus/" << sample_rate << "/" << channels << "\r\n";
_printer << "a=control:trackID=" << (int)TrackAudio << "\r\n";
}

View File

@ -193,7 +193,7 @@ protected:
//WebSocketSplitter override
/**
* webSocket数据包包头onWebSocketDecodePlayload回调
* webSocket数据包包头onWebSocketDecodePayload回调
* @param header
*/
void onWebSocketDecodeHeader(const WebSocketHeader &header) override{
@ -205,9 +205,9 @@ protected:
* @param header
* @param ptr
* @param len
* @param recved ()header._playload_len时则接受完毕
* @param recved ()header._payload_len时则接受完毕
*/
void onWebSocketDecodePlayload(const WebSocketHeader &header, const uint8_t *ptr, uint64_t len, uint64_t recved) override{
void onWebSocketDecodePayload(const WebSocketHeader &header, const uint8_t *ptr, uint64_t len, uint64_t recved) override{
_payload.append((char *)ptr,len);
}

View File

@ -161,7 +161,7 @@ protected:
* @param len
* @param recved
*/
void onWebSocketDecodePlayload(const WebSocketHeader &packet,const uint8_t *ptr,uint64_t len,uint64_t recved) override {
void onWebSocketDecodePayload(const WebSocketHeader &packet,const uint8_t *ptr,uint64_t len,uint64_t recved) override {
_remian_data.append((char *)ptr,len);
}

View File

@ -72,16 +72,16 @@ begin_decode:
CHECK_LEN(1);
_mask_flag = (*ptr & 0x80) >> 7;
_playload_len = (*ptr & 0x7F);
_payload_len = (*ptr & 0x7F);
ptr += 1;
if (_playload_len == 126) {
if (_payload_len == 126) {
CHECK_LEN(2);
_playload_len = (*ptr << 8) | *(ptr + 1);
_payload_len = (*ptr << 8) | *(ptr + 1);
ptr += 2;
} else if (_playload_len == 127) {
} else if (_payload_len == 127) {
CHECK_LEN(8);
_playload_len = ((uint64_t) ptr[0] << (8 * 7)) |
_payload_len = ((uint64_t) ptr[0] << (8 * 7)) |
((uint64_t) ptr[1] << (8 * 6)) |
((uint64_t) ptr[2] << (8 * 5)) |
((uint64_t) ptr[3] << (8 * 4)) |
@ -98,9 +98,9 @@ begin_decode:
}
_got_header = true;
_mask_offset = 0;
_playload_offset = 0;
_payload_offset = 0;
onWebSocketDecodeHeader(*this);
if(_playload_len == 0){
if(_payload_len == 0){
onWebSocketDecodeComplete(*this);
}
}
@ -109,19 +109,19 @@ begin_decode:
uint64_t remain = len - (ptr - data);
if(remain > 0){
uint64_t playload_slice_len = remain;
if(playload_slice_len + _playload_offset > _playload_len){
playload_slice_len = _playload_len - _playload_offset;
uint64_t payload_slice_len = remain;
if(payload_slice_len + _payload_offset > _payload_len){
payload_slice_len = _payload_len - _payload_offset;
}
_playload_offset += playload_slice_len;
onPlayloadData(ptr,playload_slice_len);
_payload_offset += payload_slice_len;
onPayloadData(ptr, payload_slice_len);
if(_playload_offset == _playload_len){
if(_payload_offset == _payload_len){
onWebSocketDecodeComplete(*this);
//这是下一个包
remain -= playload_slice_len;
ptr += playload_slice_len;
remain -= payload_slice_len;
ptr += payload_slice_len;
_got_header = false;
if(remain > 0){
@ -138,14 +138,14 @@ begin_decode:
_remain_data.clear();
}
void WebSocketSplitter::onPlayloadData(uint8_t *ptr, uint64_t len) {
void WebSocketSplitter::onPayloadData(uint8_t *data, uint64_t len) {
if(_mask_flag){
for(int i = 0; i < len ; ++i,++ptr){
*(ptr) ^= _mask[(i + _mask_offset) % 4];
for(int i = 0; i < len ; ++i,++data){
*(data) ^= _mask[(i + _mask_offset) % 4];
}
_mask_offset = (_mask_offset + len) % 4;
}
onWebSocketDecodePlayload(*this, _mask_flag ? ptr - len : ptr, len, _playload_offset);
onWebSocketDecodePayload(*this, _mask_flag ? data - len : data, len, _payload_offset);
}
void WebSocketSplitter::encode(const WebSocketHeader &header,const Buffer::Ptr &buffer) {

View File

@ -51,7 +51,7 @@ public:
uint8_t _reserved;
Type _opcode;
bool _mask_flag;
uint64_t _playload_len;
uint64_t _payload_len;
vector<uint8_t > _mask;
};
@ -62,7 +62,7 @@ public:
/**
* 便webSocket数据以及处理粘包问题
* onWebSocketDecodeHeader和onWebSocketDecodePlayload回调
* onWebSocketDecodeHeader和onWebSocketDecodePayload回调
* @param data
* @param len
*/
@ -77,7 +77,7 @@ public:
void encode(const WebSocketHeader &header,const Buffer::Ptr &buffer);
protected:
/**
* webSocket数据包包头onWebSocketDecodePlayload回调
* webSocket数据包包头onWebSocketDecodePayload回调
* @param header
*/
virtual void onWebSocketDecodeHeader(const WebSocketHeader &header) {};
@ -87,9 +87,9 @@ protected:
* @param header
* @param ptr
* @param len
* @param recved ()header._playload_len时则接受完毕
* @param recved ()header._payload_len时则接受完毕
*/
virtual void onWebSocketDecodePlayload(const WebSocketHeader &header, const uint8_t *ptr, uint64_t len, uint64_t recved) {};
virtual void onWebSocketDecodePayload(const WebSocketHeader &header, const uint8_t *ptr, uint64_t len, uint64_t recved) {};
/**
@ -105,12 +105,12 @@ protected:
*/
virtual void onWebSocketEncodeData(const Buffer::Ptr &buffer){};
private:
void onPlayloadData(uint8_t *data,uint64_t len);
void onPayloadData(uint8_t *data, uint64_t len);
private:
string _remain_data;
int _mask_offset = 0;
bool _got_header = false;
uint64_t _playload_offset = 0;
uint64_t _payload_offset = 0;
};
} /* namespace mediakit */

View File

@ -28,18 +28,18 @@ RtpPacket::Ptr RtpInfo::makeRtp(TrackType type, const void* data, unsigned int l
pucRtp[2] = ui16RtpLen >> 8;
pucRtp[3] = ui16RtpLen & 0x00FF;
pucRtp[4] = 0x80;
pucRtp[5] = (mark << 7) | _ui8PlayloadType;
pucRtp[5] = (mark << 7) | _ui8PayloadType;
memcpy(&pucRtp[6], &sq, 2);
memcpy(&pucRtp[8], &ts, 4);
//ssrc
memcpy(&pucRtp[12], &sc, 4);
if(data){
//playload
//payload
memcpy(&pucRtp[16], data, len);
}
rtppkt->PT = _ui8PlayloadType;
rtppkt->PT = _ui8PayloadType;
rtppkt->interleaved = _ui8Interleaved;
rtppkt->mark = mark;
rtppkt->sequence = _ui16Sequence;

View File

@ -66,7 +66,7 @@ public:
RtpInfo(uint32_t ui32Ssrc,
uint32_t ui32MtuSize,
uint32_t ui32SampleRate,
uint8_t ui8PlayloadType,
uint8_t ui8PayloadType,
uint8_t ui8Interleaved) {
if(ui32Ssrc == 0){
ui32Ssrc = ((uint64_t)this) & 0xFFFFFFFF;
@ -74,7 +74,7 @@ public:
_ui32Ssrc = ui32Ssrc;
_ui32SampleRate = ui32SampleRate;
_ui32MtuSize = ui32MtuSize;
_ui8PlayloadType = ui8PlayloadType;
_ui8PayloadType = ui8PayloadType;
_ui8Interleaved = ui8Interleaved;
}
@ -84,8 +84,8 @@ public:
return _ui8Interleaved;
}
int getPlayloadType() const {
return _ui8PlayloadType;
int getPayloadType() const {
return _ui8PayloadType;
}
int getSampleRate() const {
@ -110,7 +110,7 @@ protected:
uint32_t _ui32Ssrc;
uint32_t _ui32SampleRate;
uint32_t _ui32MtuSize;
uint8_t _ui8PlayloadType;
uint8_t _ui8PayloadType;
uint8_t _ui8Interleaved;
uint16_t _ui16Sequence = 0;
uint32_t _ui32TimeStamp = 0;

View File

@ -188,11 +188,11 @@ public:
/**
* sdp
* @param sample_rate
* @param playload_type pt类型
* @param payload_type pt类型
*/
Sdp(uint32_t sample_rate, uint8_t playload_type){
Sdp(uint32_t sample_rate, uint8_t payload_type){
_sample_rate = sample_rate;
_playload_type = playload_type;
_payload_type = payload_type;
}
virtual ~Sdp(){}
@ -207,8 +207,8 @@ public:
* pt
* @return
*/
uint8_t getPlayloadType() const{
return _playload_type;
uint8_t getPayloadType() const{
return _payload_type;
}
/**
@ -219,7 +219,7 @@ public:
return _sample_rate;
}
private:
uint8_t _playload_type;
uint8_t _payload_type;
uint32_t _sample_rate;
};