mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
Fix double free bug for RTP
This commit is contained in:
parent
ce36a970ff
commit
b1df04cb09
3 changed files with 3 additions and 12 deletions
|
@ -478,6 +478,7 @@ SrsRtcPackets::SrsRtcPackets(int nn_cache_max)
|
||||||
|
|
||||||
cursor = 0;
|
cursor = 0;
|
||||||
nn_cache = nn_cache_max;
|
nn_cache = nn_cache_max;
|
||||||
|
// TODO: FIXME: We should allocate a smaller cache, and increase it when exhausted.
|
||||||
cache = new SrsRtpPacket2[nn_cache];
|
cache = new SrsRtpPacket2[nn_cache];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -297,13 +297,6 @@ SrsRtpRawNALUs::~SrsRtpRawNALUs()
|
||||||
srs_freep(p);
|
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)
|
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);
|
srs_assert(nn > 0);
|
||||||
|
|
||||||
SrsSample* sample = new SrsSample();
|
SrsSample* sample = new SrsSample();
|
||||||
extra_nalus.push_back(sample);
|
|
||||||
samples.push_back(sample);
|
samples.push_back(sample);
|
||||||
|
|
||||||
sample->bytes = p->bytes + pos;
|
sample->bytes = p->bytes + pos;
|
||||||
|
|
|
@ -135,8 +135,6 @@ public:
|
||||||
class SrsRtpRawNALUs : public ISrsEncoder
|
class SrsRtpRawNALUs : public ISrsEncoder
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// The returned samples.
|
|
||||||
std::vector<SrsSample*> extra_nalus;
|
|
||||||
// We will manage the samples, but the sample itself point to the shared memory.
|
// We will manage the samples, but the sample itself point to the shared memory.
|
||||||
std::vector<SrsSample*> nalus;
|
std::vector<SrsSample*> nalus;
|
||||||
int nn_bytes;
|
int nn_bytes;
|
||||||
|
@ -162,7 +160,7 @@ class SrsRtpSTAPPayload : public ISrsEncoder
|
||||||
public:
|
public:
|
||||||
// The NRI in NALU type.
|
// The NRI in NALU type.
|
||||||
SrsAvcNaluType nri;
|
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.
|
// @remark We only refer to the memory, user must free its bytes.
|
||||||
std::vector<SrsSample*> nalus;
|
std::vector<SrsSample*> nalus;
|
||||||
public:
|
public:
|
||||||
|
@ -185,7 +183,7 @@ public:
|
||||||
bool start;
|
bool start;
|
||||||
bool end;
|
bool end;
|
||||||
SrsAvcNaluType nalu_type;
|
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.
|
// @remark We only refer to the memory, user must free its bytes.
|
||||||
std::vector<SrsSample*> nalus;
|
std::vector<SrsSample*> nalus;
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in a new issue