Skip to content

Commit 2328713

Browse files
committed
Make h264bitstream dependency optional
1 parent 1d1fe1a commit 2328713

3 files changed

Lines changed: 21 additions & 4 deletions

File tree

app/app.pro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,9 @@ wayland {
448448
SOURCES += streaming/video/ffmpeg-renderers/pacer/waylandvsyncsource.cpp
449449
HEADERS += streaming/video/ffmpeg-renderers/pacer/waylandvsyncsource.h
450450
}
451+
!disable-h264bitstream {
452+
DEFINES += HAVE_H264BITSTREAM
453+
}
451454

452455
RESOURCES += \
453456
resources.qrc \

app/streaming/video/ffmpeg.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
#include "utils.h"
44
#include "streaming/session.h"
55

6+
#ifdef HAVE_H264BITSTREAM
67
#include <h264_stream.h>
8+
#endif
79

810
extern "C" {
911
#include <libavutil/mastering_display_metadata.h>
@@ -715,8 +717,13 @@ bool FFmpegVideoDecoder::completeInitialization(const AVCodec* decoder, enum AVP
715717
if (testMode != TestMode::TestFrameOnly) {
716718
if ((params->videoFormat & VIDEO_FORMAT_MASK_H264) &&
717719
!(m_BackendRenderer->getDecoderCapabilities() & CAPABILITY_REFERENCE_FRAME_INVALIDATION_AVC)) {
720+
#ifdef HAVE_H264BITSTREAM
718721
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
719722
"Using H.264 SPS fixup");
723+
#else
724+
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
725+
"H.264 SPS fixup cannot be performed without h264bitstream. H.264 may have excessive decoding latency!");
726+
#endif
720727
m_NeedsSpsFixup = true;
721728
}
722729
else {
@@ -1758,6 +1765,7 @@ bool FFmpegVideoDecoder::initialize(PDECODER_PARAMETERS params)
17581765

17591766
void FFmpegVideoDecoder::writeBuffer(PLENTRY entry, int& offset)
17601767
{
1768+
#ifdef HAVE_H264BITSTREAM
17611769
if (m_NeedsSpsFixup && entry->bufferType == BUFFER_TYPE_SPS) {
17621770
h264_stream_t* stream = h264_new();
17631771
int nalStart, nalEnd;
@@ -1803,7 +1811,9 @@ void FFmpegVideoDecoder::writeBuffer(PLENTRY entry, int& offset)
18031811

18041812
h264_free(stream);
18051813
}
1806-
else {
1814+
else
1815+
#endif
1816+
{
18071817
// Write the buffer as-is
18081818
memcpy(&m_DecodeBuffer.data()[offset],
18091819
entry->data,

moonlight-qt.pro

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,20 @@ TEMPLATE = subdirs
22
SUBDIRS = \
33
moonlight-common-c \
44
qmdnsengine \
5-
app \
6-
h264bitstream
5+
app
76

87
# Build the dependencies in parallel before the final app
9-
app.depends = qmdnsengine moonlight-common-c h264bitstream
8+
app.depends = qmdnsengine moonlight-common-c
109
win32:!winrt {
1110
SUBDIRS += AntiHooking
1211
app.depends += AntiHooking
1312
}
1413

14+
!disable-h264bitstream {
15+
SUBDIRS += h264bitstream
16+
app.depends += h264bitstream
17+
}
18+
1519
# Support debug and release builds from command line for CI
1620
CONFIG += debug_and_release
1721

0 commit comments

Comments
 (0)