diff --git a/src/RtmpCodec/AACRtmpCodec.cpp b/src/RtmpCodec/AACRtmpCodec.cpp index 6ac02098..28c0dbbd 100644 --- a/src/RtmpCodec/AACRtmpCodec.cpp +++ b/src/RtmpCodec/AACRtmpCodec.cpp @@ -64,6 +64,8 @@ void AACRtmpEncoder::inputFrame(const Frame::Ptr &frame) { if(!_aac_cfg.empty()){ RtmpPacket::Ptr rtmpPkt = ResourcePoolHelper::obtainObj(); + rtmpPkt->strBuf.clear(); + //////////header uint8_t is_config = false; rtmpPkt->strBuf.push_back(_ui8AudioFlags); @@ -110,6 +112,8 @@ void AACRtmpEncoder::makeAudioConfigPkt() { _ui8AudioFlags = (flvAudioType << 4) | (flvSampleRate << 2) | (flvSampleBit << 1) | flvStereoOrMono; RtmpPacket::Ptr rtmpPkt = ResourcePoolHelper::obtainObj(); + rtmpPkt->strBuf.clear(); + //////////header uint8_t is_config = true; rtmpPkt->strBuf.push_back(_ui8AudioFlags); diff --git a/src/RtmpCodec/H264RtmpCodec.cpp b/src/RtmpCodec/H264RtmpCodec.cpp index e46932ec..76357f6e 100644 --- a/src/RtmpCodec/H264RtmpCodec.cpp +++ b/src/RtmpCodec/H264RtmpCodec.cpp @@ -123,6 +123,8 @@ void H264RtmpEncoder::inputFrame(const Frame::Ptr &frame) { flags |= ((keyFrame ? FLV_KEY_FRAME : FLV_INTER_FRAME) << 4); RtmpPacket::Ptr rtmpPkt = ResourcePoolHelper::obtainObj(); + rtmpPkt->strBuf.clear(); + rtmpPkt->strBuf.push_back(flags); rtmpPkt->strBuf.push_back(!is_config); rtmpPkt->strBuf.append("\x0\x0\x0", 3); @@ -151,6 +153,8 @@ void H264RtmpEncoder::makeVideoConfigPkt() { bool is_config = true; RtmpPacket::Ptr rtmpPkt = ResourcePoolHelper::obtainObj(); + rtmpPkt->strBuf.clear(); + //////////header rtmpPkt->strBuf.push_back(flags); rtmpPkt->strBuf.push_back(!is_config);