VNC-151 Introduce DEBUG_LOG macro for debug encoder logging

This commit is contained in:
El 2026-03-16 07:06:20 +00:00
parent f4129057f6
commit 564baa6a54
No known key found for this signature in database
GPG key ID: EB3F4C9EA29CDE59
2 changed files with 12 additions and 2 deletions

View file

@ -124,7 +124,7 @@ namespace rfb {
}
if (pkt->flags & AV_PKT_FLAG_KEY)
vlog.debug("Key frame %ld", frame->pts);
DEBUG_LOG(vlog, "Key frame %ld", frame->pts);
return true;
}
@ -138,7 +138,7 @@ namespace rfb {
os->writeU8(pkt->flags & AV_PKT_FLAG_KEY);
encoders::write_compact(os, pkt->size);
os->writeBytes(&pkt->data[0], pkt->size);
vlog.debug("Screen id %d, codec %d, frame size: %d", layout.id, msg_codec_id, pkt->size);
DEBUG_LOG(vlog, "Screen id %d, codec %d, frame size: %d", layout.id, msg_codec_id, pkt->size);
ffmpeg.av_packet_unref(pkt);
}

View file

@ -3,5 +3,15 @@
#include "rdr/OutStream.h"
namespace rfb::encoders {
#define DEBUG_ENCODERS 1
#if DEBUG_ENCODERS
#define DEBUG_LOG(log, ...) \
log.debug(__VA_ARGS__)
#else
#define DEBUG_LOG(log, ...)
#endif
void write_compact(rdr::OutStream *os, int value);
} // namespace rfb::encoders