修复循环池导致的bug

This commit is contained in:
xiongziliang 2018-10-24 17:50:09 +08:00
parent 9f16cc1201
commit 2c413e0742
2 changed files with 8 additions and 0 deletions

View File

@ -64,6 +64,8 @@ void AACRtmpEncoder::inputFrame(const Frame::Ptr &frame) {
if(!_aac_cfg.empty()){ if(!_aac_cfg.empty()){
RtmpPacket::Ptr rtmpPkt = ResourcePoolHelper<RtmpPacket>::obtainObj(); RtmpPacket::Ptr rtmpPkt = ResourcePoolHelper<RtmpPacket>::obtainObj();
rtmpPkt->strBuf.clear();
//////////header //////////header
uint8_t is_config = false; uint8_t is_config = false;
rtmpPkt->strBuf.push_back(_ui8AudioFlags); rtmpPkt->strBuf.push_back(_ui8AudioFlags);
@ -110,6 +112,8 @@ void AACRtmpEncoder::makeAudioConfigPkt() {
_ui8AudioFlags = (flvAudioType << 4) | (flvSampleRate << 2) | (flvSampleBit << 1) | flvStereoOrMono; _ui8AudioFlags = (flvAudioType << 4) | (flvSampleRate << 2) | (flvSampleBit << 1) | flvStereoOrMono;
RtmpPacket::Ptr rtmpPkt = ResourcePoolHelper<RtmpPacket>::obtainObj(); RtmpPacket::Ptr rtmpPkt = ResourcePoolHelper<RtmpPacket>::obtainObj();
rtmpPkt->strBuf.clear();
//////////header //////////header
uint8_t is_config = true; uint8_t is_config = true;
rtmpPkt->strBuf.push_back(_ui8AudioFlags); rtmpPkt->strBuf.push_back(_ui8AudioFlags);

View File

@ -123,6 +123,8 @@ void H264RtmpEncoder::inputFrame(const Frame::Ptr &frame) {
flags |= ((keyFrame ? FLV_KEY_FRAME : FLV_INTER_FRAME) << 4); flags |= ((keyFrame ? FLV_KEY_FRAME : FLV_INTER_FRAME) << 4);
RtmpPacket::Ptr rtmpPkt = ResourcePoolHelper<RtmpPacket>::obtainObj(); RtmpPacket::Ptr rtmpPkt = ResourcePoolHelper<RtmpPacket>::obtainObj();
rtmpPkt->strBuf.clear();
rtmpPkt->strBuf.push_back(flags); rtmpPkt->strBuf.push_back(flags);
rtmpPkt->strBuf.push_back(!is_config); rtmpPkt->strBuf.push_back(!is_config);
rtmpPkt->strBuf.append("\x0\x0\x0", 3); rtmpPkt->strBuf.append("\x0\x0\x0", 3);
@ -151,6 +153,8 @@ void H264RtmpEncoder::makeVideoConfigPkt() {
bool is_config = true; bool is_config = true;
RtmpPacket::Ptr rtmpPkt = ResourcePoolHelper<RtmpPacket>::obtainObj(); RtmpPacket::Ptr rtmpPkt = ResourcePoolHelper<RtmpPacket>::obtainObj();
rtmpPkt->strBuf.clear();
//////////header //////////header
rtmpPkt->strBuf.push_back(flags); rtmpPkt->strBuf.push_back(flags);
rtmpPkt->strBuf.push_back(!is_config); rtmpPkt->strBuf.push_back(!is_config);