mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-03-30 03:32:14 -04:00
Add guard to handle resetting AVPacket after use.
Also handle allocation failures.
This commit is contained in:
@@ -221,6 +221,8 @@ int FfmpegCamera::Capture(std::shared_ptr<ZMPacket> &zm_packet) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
av_packet_guard pkt_guard{packet};
|
||||
|
||||
AVStream *stream = formatContextPtr->streams[packet->stream_index];
|
||||
ZM_DUMP_STREAM_PACKET(stream, packet, "ffmpeg_camera in");
|
||||
|
||||
@@ -243,7 +245,6 @@ int FfmpegCamera::Capture(std::shared_ptr<ZMPacket> &zm_packet) {
|
||||
mLastAudioPTS = packet->pts - mFirstAudioPTS;
|
||||
}
|
||||
}
|
||||
zm_av_packet_unref(packet.get());
|
||||
|
||||
return 1;
|
||||
} // FfmpegCamera::Capture
|
||||
|
||||
Reference in New Issue
Block a user