record: use pkt after free have no effects

Origin commit data
------------------
Commit: 723db7d688
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2021-11-20 (Sat, 20 Nov 2021)
This commit is contained in:
Jacek Jendrzej
2021-11-20 18:42:49 +01:00
committed by vanhofen
parent ef46d03024
commit 139537438c

View File

@@ -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();