整理代码

This commit is contained in:
xiongziliang
2018-10-21 21:45:44 +08:00
parent 872c0c8b97
commit 0f6a7c1656
5 changed files with 183 additions and 128 deletions

View File

@@ -10,30 +10,45 @@
using namespace ZL::Util;
class H264RtpCodec : public RtpEncoder {
class H264RtpDecoder : public RtpCodec {
public:
H264RtpCodec(uint32_t ui32Ssrc,
uint32_t ui32MtuSize = 1400,
uint32_t ui32SampleRate = 90000,
uint8_t ui8PlayloadType = 96,
uint8_t ui8Interleaved = TrackVideo * 2) :
RtpEncoder(ui32Ssrc,ui32MtuSize,ui32SampleRate,ui8PlayloadType,ui8Interleaved) {
H264RtpDecoder() {
m_framePool.setSize(32);
m_h264frame = m_framePool.obtain();
}
~H264RtpCodec(){}
void inputFame(const Frame::Ptr &frame,bool key_pos) override;
void inputRtp(const RtpPacket::Ptr &rtp, bool key_pos) override ;
~H264RtpDecoder() {}
void inputRtp(const RtpPacket::Ptr &rtp, bool key_pos) override;
private:
void makeH264Rtp(const void *pData, unsigned int uiLen, bool bMark, uint32_t uiStamp);
bool decodeRtp(const RtpPacket::Ptr &rtp, bool key_pos);
void onGetH264(const H264Frame::Ptr &frame);
private:
unsigned char m_aucSectionBuf[1600];
H264Frame::Ptr m_h264frame;
ResourcePool<H264Frame> m_framePool;
};
class H264RtpEncoder : public RtpInfo, public RtpCodec {
public:
H264RtpEncoder(uint32_t ui32Ssrc,
uint32_t ui32MtuSize = 1400,
uint32_t ui32SampleRate = 90000,
uint8_t ui8PlayloadType = 96,
uint8_t ui8Interleaved = TrackVideo * 2);
~H264RtpEncoder() {}
void inputFame(const Frame::Ptr &frame, bool key_pos) override;
private:
void makeH264Rtp(const void *pData, unsigned int uiLen, bool bMark, uint32_t uiStamp);
private:
unsigned char m_aucSectionBuf[1600];
};
#endif //ZLMEDIAKIT_H264RTPCODEC_H