Bug 1338023. Part 1 - add OggPacketDeletePolicy. r=gerald

MozReview-Commit-ID: KhuMed88j4V

--HG--
extra : rebase_source : e06d6bdb5efc87fb570282e6526c39825ea8821c
extra : intermediate-source : c1acded5a6e942c4b4daba3dac3074ab554f9dbf
extra : source : c90ca181c02d1f69c12b1e1f08d7501c28df3937
This commit is contained in:
JW Wang 2017-02-07 17:56:41 +08:00
Родитель 0a462392c1
Коммит ce84ae38fd
2 изменённых файлов: 12 добавлений и 6 удалений

Просмотреть файл

@ -205,9 +205,8 @@ void
OggCodecState::ReleasePacket(ogg_packet* aPacket)
{
if (aPacket) {
delete [] aPacket->packet;
OggPacketDeletePolicy()(aPacket);
}
delete aPacket;
}
void

Просмотреть файл

@ -36,14 +36,21 @@ namespace mozilla {
class OpusParser;
struct OggPacketDeletePolicy
{
void operator()(ogg_packet* aPacket) const
{
delete [] aPacket->packet;
delete aPacket;
}
};
// Deallocates a packet, used in OggPacketQueue below.
class OggPacketDeallocator : public nsDequeFunctor
{
virtual void* operator() (void* aPacket)
virtual void* operator()(void* aPacket)
{
ogg_packet* p = static_cast<ogg_packet*>(aPacket);
delete [] p->packet;
delete p;
OggPacketDeletePolicy()(static_cast<ogg_packet*>(aPacket));
return nullptr;
}
};