ZLMediaKit/src/RTP/AACRtpCodec.h

38 lines
1.0 KiB
C
Raw Normal View History

2018-10-18 23:48:00 +08:00
//
// Created by xzl on 2018/10/18.
//
#ifndef ZLMEDIAKIT_AACRTPCODEC_H
#define ZLMEDIAKIT_AACRTPCODEC_H
#include "RtpCodec.h"
2018-10-21 21:21:14 +08:00
class AACRtpCodec : public RtpEncoder {
2018-10-18 23:48:00 +08:00
public:
2018-10-21 21:21:14 +08:00
AACRtpCodec(uint32_t ui32Ssrc,
2018-10-18 23:48:00 +08:00
uint32_t ui32MtuSize ,
uint32_t ui32SampleRate,
uint8_t ui8PlayloadType = 97,
uint8_t ui8Interleaved = TrackAudio * 2) :
RtpEncoder(ui32Ssrc,ui32MtuSize,ui32SampleRate,ui8PlayloadType,ui8Interleaved) {
2018-10-21 21:21:14 +08:00
m_framePool.setSize(32);
m_adts = m_framePool.obtain();
2018-10-18 23:48:00 +08:00
}
2018-10-21 21:21:14 +08:00
~AACRtpCodec(){}
2018-10-18 23:48:00 +08:00
void inputFame(const Frame::Ptr &frame,bool key_pos) override;
2018-10-21 21:21:14 +08:00
void inputRtp(const RtpPacket::Ptr &rtp, bool key_pos) override ;
2018-10-18 23:48:00 +08:00
private:
void makeAACRtp(const void *pData, unsigned int uiLen, bool bMark, uint32_t uiStamp);
2018-10-21 21:21:14 +08:00
void onGetAdts(const AdtsFrame::Ptr &frame);
2018-10-18 23:48:00 +08:00
private:
unsigned char m_aucSectionBuf[1600];
AdtsFrame::Ptr m_adts;
2018-10-21 21:21:14 +08:00
ResourcePool<AdtsFrame> m_framePool;
2018-10-18 23:48:00 +08:00
};
2018-10-21 21:21:14 +08:00
2018-10-18 23:48:00 +08:00
#endif //ZLMEDIAKIT_AACRTPCODEC_H