Expose AMF driver diagnostics and effective encoder settings
This commit is contained in:
1 parent
b8bc9b409a
commit
78b147f806
4 files changed
+86
-14
No files matched your search
@@ -36,6 +36,7 @@ extern "C" {
|
||||
#include "mem.h"
|
||||
#include "sqlite3.h"
|
||||
#include "opus_codec.h"
|
||||
#include "video/video.h"
|
||||
#ifdef HAVE_FFMPEG
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavutil/mem.h>
|
||||
@@ -128,6 +129,13 @@ extern "C" void __wrap_ma_device_uninit(ma_device* device) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FFMPEG
|
||||
static QStringList ffmpegDiagnosticMessages;
|
||||
static void captureFfmpegDiagnostic(int, const char*, const char* message) {
|
||||
if (strstr(message, "UTUN_AMF_LOG_TEST")) ffmpegDiagnosticMessages.append(QString::fromUtf8(message));
|
||||
}
|
||||
#endif
|
||||
|
||||
class StreamPublishTest : public QObject {
|
||||
Q_OBJECT
|
||||
UASYNC* ua = nullptr;
|
||||
@@ -183,6 +191,38 @@ private slots:
|
||||
sqlite3_finalize(statement); QVERIFY(group); QVERIFY(gui_stream_attach(inst)); uasync_mark_running(ua);
|
||||
connect(&poll, &QTimer::timeout, this, [this] { uasync_poll(ua, 0); }); poll.start(1);
|
||||
}
|
||||
void amfDriverDiagnosticsRespectCategoryFilter() {
|
||||
#ifdef HAVE_FFMPEG
|
||||
video_ffmpeg_init();
|
||||
auto previousDebug = g_debug_config.category_levels[DEBUG_CATEGORY_DEBUG];
|
||||
auto previousVideo = g_debug_config.category_levels[DEBUG_CATEGORY_VIDEO];
|
||||
AVCodecContext* context = avcodec_alloc_context3(nullptr); QVERIFY(context);
|
||||
auto cleanup = qScopeGuard([&] {
|
||||
context->codec = nullptr; avcodec_free_context(&context); debug_set_log_hook(nullptr);
|
||||
debug_set_category_level(DEBUG_CATEGORY_DEBUG, previousDebug);
|
||||
debug_set_category_level(DEBUG_CATEGORY_VIDEO, previousVideo); ffmpegDiagnosticMessages.clear();
|
||||
});
|
||||
AVCodec codec{}; codec.name = "hevc_amf"; context->codec = &codec;
|
||||
debug_set_log_hook(captureFfmpegDiagnostic);
|
||||
debug_set_category_level(DEBUG_CATEGORY_DEBUG, DEBUG_LEVEL_TRACE);
|
||||
debug_set_category_level(DEBUG_CATEGORY_VIDEO, DEBUG_LEVEL_WARN);
|
||||
av_log(context, AV_LOG_DEBUG, "UTUN_AMF_LOG_TEST driver value=%d\n", 17);
|
||||
QCOMPARE(ffmpegDiagnosticMessages.size(), 1);
|
||||
QVERIFY(ffmpegDiagnosticMessages.front().contains("encoder=hevc_amf: UTUN_AMF_LOG_TEST driver value=17"));
|
||||
codec.name = "libx264";
|
||||
av_log(context, AV_LOG_DEBUG, "UTUN_AMF_LOG_TEST unrelated encoder\n");
|
||||
av_log(nullptr, AV_LOG_DEBUG, "UTUN_AMF_LOG_TEST unrelated context\n");
|
||||
QCOMPARE(ffmpegDiagnosticMessages.size(), 1);
|
||||
codec.name = "hevc_amf"; debug_set_category_level(DEBUG_CATEGORY_DEBUG, DEBUG_LEVEL_INFO);
|
||||
av_log(context, AV_LOG_DEBUG, "UTUN_AMF_LOG_TEST driver disabled\n");
|
||||
QCOMPARE(ffmpegDiagnosticMessages.size(), 1);
|
||||
av_log(nullptr, AV_LOG_ERROR, "UTUN_AMF_LOG_TEST normal error\n");
|
||||
QCOMPARE(ffmpegDiagnosticMessages.size(), 2);
|
||||
QVERIFY(ffmpegDiagnosticMessages.back().contains("normal error"));
|
||||
#else
|
||||
QSKIP("FFmpeg unavailable");
|
||||
#endif
|
||||
}
|
||||
void captureSettingsSurviveReopening() {
|
||||
QString saved;
|
||||
QVariantList selectedMode;
|
||||
|
||||
Reference in new issue
Block a user