Fix double free bug for RTP

pull/1748/head
winlin 5 years ago
parent ce36a970ff
commit b1df04cb09

@ -478,6 +478,7 @@ SrsRtcPackets::SrsRtcPackets(int nn_cache_max)
cursor = 0;
nn_cache = nn_cache_max;
// TODO: FIXME: We should allocate a smaller cache, and increase it when exhausted.
cache = new SrsRtpPacket2[nn_cache];
}

@ -297,13 +297,6 @@ SrsRtpRawNALUs::~SrsRtpRawNALUs()
srs_freep(p);
}
}
if (true) {
int nn_nalus = (int)extra_nalus.size();
for (int i = 0; i < nn_nalus; i++) {
SrsSample* p = extra_nalus[i];
srs_freep(p);
}
}
}
void SrsRtpRawNALUs::push_back(SrsSample* sample)
@ -356,7 +349,6 @@ srs_error_t SrsRtpRawNALUs::read_samples(vector<SrsSample*>& samples, int packet
srs_assert(nn > 0);
SrsSample* sample = new SrsSample();
extra_nalus.push_back(sample);
samples.push_back(sample);
sample->bytes = p->bytes + pos;

@ -135,8 +135,6 @@ public:
class SrsRtpRawNALUs : public ISrsEncoder
{
private:
// The returned samples.
std::vector<SrsSample*> extra_nalus;
// We will manage the samples, but the sample itself point to the shared memory.
std::vector<SrsSample*> nalus;
int nn_bytes;
@ -162,7 +160,7 @@ class SrsRtpSTAPPayload : public ISrsEncoder
public:
// The NRI in NALU type.
SrsAvcNaluType nri;
// The NALU samples.
// The NALU samples, we will manage the samples.
// @remark We only refer to the memory, user must free its bytes.
std::vector<SrsSample*> nalus;
public:
@ -185,7 +183,7 @@ public:
bool start;
bool end;
SrsAvcNaluType nalu_type;
// The NALU samples.
// The NALU samples, we manage the samples.
// @remark We only refer to the memory, user must free its bytes.
std::vector<SrsSample*> nalus;
public:

Loading…
Cancel
Save