From 139537438c20f6d00f6d597416ca565514025afa Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sat, 20 Nov 2021 18:42:49 +0100 Subject: [PATCH] record: use pkt after free have no effects Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/723db7d688ed9e0a960f421802fb434534aafe64 Author: Jacek Jendrzej Date: 2021-11-20 (Sat, 20 Nov 2021) --- src/driver/record.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/driver/record.cpp b/src/driver/record.cpp index fa34c0892..3f58b5ac2 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -2472,14 +2472,14 @@ void CStreamRec::run() pkt.pts = av_rescale_q(pkt.pts, ifcx->streams[pkt.stream_index]->time_base, ofcx->streams[pkt.stream_index]->time_base); pkt.dts = av_rescale_q(pkt.dts, ifcx->streams[pkt.stream_index]->time_base, ofcx->streams[pkt.stream_index]->time_base); - av_write_frame(ofcx, &pkt); - av_packet_unref(&pkt); - if (pkt.stream_index == stream_index) { total += (double) 1000 * pkt.duration * av_q2d(ifcx->streams[stream_index]->time_base); //printf("PKT: duration %d (%f) total %f (ifcx->duration %016llx\n", pkt.duration, duration, total, ifcx->duration); } + av_write_frame(ofcx, &pkt); + av_packet_unref(&pkt); + if (now == 0) WriteHeader(1000); now = time_monotonic();