Cleanup LockedPacket, use RAII
parent
b552436375
commit
10d8ccf244
|
@ -126,10 +126,9 @@ bool PacketQueue::queuePacket(std::shared_ptr<ZMPacket> add_packet) {
|
||||||
) {
|
) {
|
||||||
std::shared_ptr <ZMPacket>zm_packet = *it;
|
std::shared_ptr <ZMPacket>zm_packet = *it;
|
||||||
|
|
||||||
ZMLockedPacket *lp = new ZMLockedPacket(zm_packet);
|
ZMLockedPacket lp(zm_packet);
|
||||||
if (!lp->trylock()) {
|
if (!lp.trylock()) {
|
||||||
Warning("Found locked packet when trying to free up video packets. This basically means that decoding is not keeping up.");
|
Warning("Found locked packet when trying to free up video packets. This basically means that decoding is not keeping up.");
|
||||||
delete lp;
|
|
||||||
++it;
|
++it;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -158,8 +157,6 @@ bool PacketQueue::queuePacket(std::shared_ptr<ZMPacket> add_packet) {
|
||||||
max_video_packet_count,
|
max_video_packet_count,
|
||||||
pktQueue.size());
|
pktQueue.size());
|
||||||
|
|
||||||
delete lp;
|
|
||||||
|
|
||||||
if (zm_packet->packet.stream_index == video_stream_id)
|
if (zm_packet->packet.stream_index == video_stream_id)
|
||||||
break;
|
break;
|
||||||
} // end while
|
} // end while
|
||||||
|
|
Loading…
Reference in New Issue