diff --git a/app/app.pro b/app/app.pro index e3fb19a5..b18d29b5 100644 --- a/app/app.pro +++ b/app/app.pro @@ -448,6 +448,9 @@ wayland { SOURCES += streaming/video/ffmpeg-renderers/pacer/waylandvsyncsource.cpp HEADERS += streaming/video/ffmpeg-renderers/pacer/waylandvsyncsource.h } +!disable-h264bitstream { + DEFINES += HAVE_H264BITSTREAM +} RESOURCES += \ resources.qrc \ diff --git a/app/streaming/video/ffmpeg.cpp b/app/streaming/video/ffmpeg.cpp index 5e1f2c62..d1bbfce0 100644 --- a/app/streaming/video/ffmpeg.cpp +++ b/app/streaming/video/ffmpeg.cpp @@ -3,7 +3,9 @@ #include "utils.h" #include "streaming/session.h" +#ifdef HAVE_H264BITSTREAM #include +#endif extern "C" { #include @@ -715,8 +717,13 @@ bool FFmpegVideoDecoder::completeInitialization(const AVCodec* decoder, enum AVP if (testMode != TestMode::TestFrameOnly) { if ((params->videoFormat & VIDEO_FORMAT_MASK_H264) && !(m_BackendRenderer->getDecoderCapabilities() & CAPABILITY_REFERENCE_FRAME_INVALIDATION_AVC)) { +#ifdef HAVE_H264BITSTREAM SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Using H.264 SPS fixup"); +#else + SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, + "H.264 SPS fixup cannot be performed without h264bitstream. H.264 may have excessive decoding latency!"); +#endif m_NeedsSpsFixup = true; } else { @@ -1758,6 +1765,7 @@ bool FFmpegVideoDecoder::initialize(PDECODER_PARAMETERS params) void FFmpegVideoDecoder::writeBuffer(PLENTRY entry, int& offset) { +#ifdef HAVE_H264BITSTREAM if (m_NeedsSpsFixup && entry->bufferType == BUFFER_TYPE_SPS) { h264_stream_t* stream = h264_new(); int nalStart, nalEnd; @@ -1803,7 +1811,9 @@ void FFmpegVideoDecoder::writeBuffer(PLENTRY entry, int& offset) h264_free(stream); } - else { + else +#endif + { // Write the buffer as-is memcpy(&m_DecodeBuffer.data()[offset], entry->data, diff --git a/moonlight-qt.pro b/moonlight-qt.pro index c8d42006..e610ff81 100644 --- a/moonlight-qt.pro +++ b/moonlight-qt.pro @@ -2,16 +2,20 @@ TEMPLATE = subdirs SUBDIRS = \ moonlight-common-c \ qmdnsengine \ - app \ - h264bitstream + app # Build the dependencies in parallel before the final app -app.depends = qmdnsengine moonlight-common-c h264bitstream +app.depends = qmdnsengine moonlight-common-c win32:!winrt { SUBDIRS += AntiHooking app.depends += AntiHooking } +!disable-h264bitstream { + SUBDIRS += h264bitstream + app.depends += h264bitstream +} + # Support debug and release builds from command line for CI CONFIG += debug_and_release