From 43bda2de2de3f8fa3d2761d2446523d6ccf789f8 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Tue, 21 May 2024 20:43:08 +0000 Subject: [PATCH] Add some telemetry --- src/demuxer.cc | 4 ++++ src/playervideorec.cc | 3 +++ src/stream.cc | 29 ++++++++++++++++++++++++++--- src/stream.h | 3 +++ src/videoomx.cc | 4 ++++ 5 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/demuxer.cc b/src/demuxer.cc index a9e176e..2e7e793 100644 --- a/src/demuxer.cc +++ b/src/demuxer.cc @@ -24,6 +24,7 @@ #include "callback.h" #include "dvbsubtitles.h" #include "log.h" +#include "telem.h" #include #include @@ -701,6 +702,9 @@ bool Demuxer::writeTeletext(bool * dataavail) bool Demuxer::submitPacket(PESPacket& packet) { + TELEM(2, packet.getPacketType()); + TELEM(3, packet.getPTS()); + u4 sent = 0; u1 packet_type = packet.getPacketType(); const u1* packetdata = packet.getData(); diff --git a/src/playervideorec.cc b/src/playervideorec.cc index 9e598dc..cab6486 100644 --- a/src/playervideorec.cc +++ b/src/playervideorec.cc @@ -31,6 +31,7 @@ #include "osdreceiver.h" #include "buffer.h" #include "util.h" +#include "telem.h" #include "playervideorec.h" @@ -1149,6 +1150,8 @@ void PlayerVideoRec::threadFeedPlay() threadBuffer.set(vdr->getBlock(feedPosition, askFor, &thisRead)); //logger->log("Player", Log::DEBUG, "Get Block out"); + TELEM(1, feedPosition); + feedPosition += thisRead; if (!vdr->isConnected()) diff --git a/src/stream.cc b/src/stream.cc index 73dd5f2..9af19c7 100644 --- a/src/stream.cc +++ b/src/stream.cc @@ -22,8 +22,18 @@ #include //#include "oldlog.h" + +#include "telem.h" + #include "stream.h" +int Stream::which{}; + +Stream::Stream() +{ + localWhich = which++; +} + Stream::~Stream() { shutdown(); @@ -99,12 +109,25 @@ int Stream::put(const u1* inbuf, int len, u1 type, unsigned int index) hasdts = true; } + TELEM((localWhich ? 11 : 4), newPacket.pts); + TELEM((localWhich ? 12 : 5), newPacket.dts); + //ok we have the pts now convert it to a continously time code in 100ns units - if (hasdts && draintarget->dtsTimefix()) newPacket.presentation_time = static_cast(newPacket.dts * 10000LL / 90LL); - else newPacket.presentation_time = static_cast(newPacket.pts * 10000LL / 90LL); + if (hasdts && draintarget->dtsTimefix()) newPacket.presentation_time = static_cast(newPacket.dts * 10000LL / 90LL); // Windows only + else newPacket.presentation_time = static_cast(newPacket.pts * 10000LL / 90LL); + + TELEM((localWhich ? 13 : 6), newPacket.presentation_time); + + // now PTS & DTS are original, presentation_time is OMX ticks. If it's rolled, it's rolled! //newPacket.presentation_time-=draintarget->SetStartOffset(static_cast(newPacket.pts*10000LL/90LL),&newPacket.disconti); - newPacket.presentation_time -= draintarget->SetStartOffset(static_cast(newPacket.pts * 10000LL / 90LL), &newPacket.disconti); + //newPacket.presentation_time -= draintarget->SetStartOffset(static_cast(newPacket.pts * 10000LL / 90LL), &newPacket.disconti); + long long returnedStartOffset = draintarget->SetStartOffset(static_cast(newPacket.pts * 10000LL / 90LL), &newPacket.disconti); + newPacket.presentation_time -= returnedStartOffset; + //LogNT::getInstance()->debug("MP", "draintarget {} PTSmod {} disconti {} rso: {}", (void*)draintarget, newPacket.presentation_time, newPacket.disconti, returnedStartOffset); + + TELEM((localWhich ? 14 : 7), newPacket.presentation_time); + TELEM((localWhich ? 15 : 8), returnedStartOffset); } } diff --git a/src/stream.h b/src/stream.h index 22c4b4b..c9859fc 100644 --- a/src/stream.h +++ b/src/stream.h @@ -28,6 +28,7 @@ class Stream { public: + Stream(); ~Stream(); int init(DrainTarget* tdt, int bufsize); void shutdown(); @@ -36,6 +37,8 @@ class Stream bool drain(bool* dataavail = NULL); private: + static int which; + int localWhich{}; MediaPacketList mediapackets; u4 cur_packet_pos{}; std::mutex mutex; diff --git a/src/videoomx.cc b/src/videoomx.cc index d9b2984..d07a93e 100644 --- a/src/videoomx.cc +++ b/src/videoomx.cc @@ -33,6 +33,7 @@ #include "inputman.h" #include "util.h" #include "config.h" +#include "telem.h" #include "videoomx.h" @@ -3184,6 +3185,8 @@ u4 VideoOMX::DeliverMediaPacket(MediaPacket packet, const u1* buffer, u4* sample // logger->debug(TAG, "DMP mark 1"); //logger->debug(TAG, "DeliverMediaPacketOMX time {}", packet.presentation_time); + TELEM(9, packet.presentation_time); + /*First Check, if we have an video sample*/ if (iframemode) { @@ -3302,6 +3305,7 @@ u4 VideoOMX::DeliverMediaPacket(MediaPacket packet, const u1* buffer, u4* sample } lastreftimeOMX = packet.presentation_time; + TELEM(10, lastreftimeOMX); // logger->debug(TAG, "Time code {} pts {}", lastreftimeOMX,packet.pts); lastreftimePTS = packet.pts; cur_input_buf_omx->nTimeStamp = intToOMXTicks(lastreftimeOMX / 10LL); // the clock component is faulty; -- 2.39.5