mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2025-12-23 22:37:53 -05:00
If WallClockTimetsamps is set, use the wallclock timestamp in the ZMPacket to override ptd, dts in the packet. Please note that it gets converted to in_stream->timebase and then to out_stream time_base.
This commit is contained in:
@@ -151,7 +151,7 @@ bool VideoStore::open() {
|
|||||||
reorder_queue_size = std::stoul(entry->value);
|
reorder_queue_size = std::stoul(entry->value);
|
||||||
// remove it to prevent complaining later.
|
// remove it to prevent complaining later.
|
||||||
av_dict_set(&opts, "reorder_queue_size", nullptr, AV_DICT_MATCH_CASE);
|
av_dict_set(&opts, "reorder_queue_size", nullptr, AV_DICT_MATCH_CASE);
|
||||||
} else if (monitor->has_out_of_order_packets()) {
|
} else if (monitor->has_out_of_order_packets() and !monitor->WallClockTimestamps()) {
|
||||||
reorder_queue_size = 2*monitor->get_max_keyframe_interval();
|
reorder_queue_size = 2*monitor->get_max_keyframe_interval();
|
||||||
}
|
}
|
||||||
Debug(1, "reorder_queue_size set to %zu", reorder_queue_size);
|
Debug(1, "reorder_queue_size set to %zu", reorder_queue_size);
|
||||||
@@ -1283,7 +1283,11 @@ int VideoStore::writeVideoFramePacket(const std::shared_ptr<ZMPacket> zm_packet)
|
|||||||
av_packet_ref(opkt.get(), ipkt);
|
av_packet_ref(opkt.get(), ipkt);
|
||||||
pkt_guard.acquire(opkt);
|
pkt_guard.acquire(opkt);
|
||||||
|
|
||||||
if (ipkt->dts != AV_NOPTS_VALUE) {
|
if (monitor->WallClockTimestamps()) {
|
||||||
|
Microseconds useconds = std::chrono::duration_cast<Microseconds>(
|
||||||
|
zm_packet->timestamp - SystemTimePoint(Microseconds(video_first_pts)));
|
||||||
|
opkt->pts = opkt->dts = av_rescale_q(useconds.count(), AV_TIME_BASE_Q, video_in_stream->time_base);
|
||||||
|
} else if (ipkt->dts != AV_NOPTS_VALUE) {
|
||||||
if (video_first_dts == AV_NOPTS_VALUE) {
|
if (video_first_dts == AV_NOPTS_VALUE) {
|
||||||
Debug(2, "Starting video first_dts will become %" PRId64, ipkt->dts);
|
Debug(2, "Starting video first_dts will become %" PRId64, ipkt->dts);
|
||||||
video_first_dts = ipkt->dts;
|
video_first_dts = ipkt->dts;
|
||||||
|
|||||||
Reference in New Issue
Block a user