mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-02-06 00:39:54 +00:00
Remove 3-byte NALU prefix fixup
The bug in Moonlight that required it has been fixed since the middle of last year.
This commit is contained in:
parent
82d6bc28c3
commit
18ab7dcf6c
@ -27,9 +27,6 @@ extern "C" {
|
||||
using namespace std::literals;
|
||||
namespace video {
|
||||
|
||||
constexpr auto hevc_nalu = "\000\000\000\001("sv;
|
||||
constexpr auto h264_nalu = "\000\000\000\001e"sv;
|
||||
|
||||
void
|
||||
free_ctx(AVCodecContext *ctx) {
|
||||
avcodec_free_context(&ctx);
|
||||
@ -280,7 +277,6 @@ namespace video {
|
||||
CBR, // Some encoders don't support CBR, if not supported --> attempt constant quantatication parameter instead
|
||||
DYNAMIC_RANGE, // hdr
|
||||
VUI_PARAMETERS, // AMD encoder with VAAPI doesn't add VUI parameters to SPS
|
||||
NALU_PREFIX_5b, // libx264/libx265 have a 3-byte nalu prefix instead of 4-byte nalu prefix
|
||||
MAX_FLAGS
|
||||
};
|
||||
|
||||
@ -295,7 +291,6 @@ namespace video {
|
||||
_CONVERT(CBR);
|
||||
_CONVERT(DYNAMIC_RANGE);
|
||||
_CONVERT(VUI_PARAMETERS);
|
||||
_CONVERT(NALU_PREFIX_5b);
|
||||
_CONVERT(MAX_FLAGS);
|
||||
}
|
||||
#undef _CONVERT
|
||||
@ -1359,12 +1354,6 @@ namespace video {
|
||||
(1 - (int) video_format[encoder_t::VUI_PARAMETERS]) * (1 + config.videoFormat),
|
||||
};
|
||||
|
||||
if (!video_format[encoder_t::NALU_PREFIX_5b]) {
|
||||
auto nalu_prefix = config.videoFormat ? hevc_nalu : h264_nalu;
|
||||
|
||||
session.replacements.emplace_back(nalu_prefix.substr(1), nalu_prefix);
|
||||
}
|
||||
|
||||
return std::make_optional(std::move(session));
|
||||
}
|
||||
|
||||
@ -1790,7 +1779,6 @@ namespace video {
|
||||
|
||||
enum validate_flag_e {
|
||||
VUI_PARAMS = 0x01,
|
||||
NALU_PREFIX_5b = 0x02,
|
||||
};
|
||||
|
||||
int
|
||||
@ -1843,12 +1831,6 @@ namespace video {
|
||||
flag |= VUI_PARAMS;
|
||||
}
|
||||
|
||||
auto nalu_prefix = config.videoFormat ? hevc_nalu : h264_nalu;
|
||||
std::string_view payload { (char *) av_packet->data, (std::size_t) av_packet->size };
|
||||
if (std::search(std::begin(payload), std::end(payload), std::begin(nalu_prefix), std::end(nalu_prefix)) != std::end(payload)) {
|
||||
flag |= NALU_PREFIX_5b;
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
@ -1892,7 +1874,6 @@ namespace video {
|
||||
|
||||
std::vector<std::pair<validate_flag_e, encoder_t::flag_e>> packet_deficiencies {
|
||||
{ VUI_PARAMS, encoder_t::VUI_PARAMETERS },
|
||||
{ NALU_PREFIX_5b, encoder_t::NALU_PREFIX_5b },
|
||||
};
|
||||
|
||||
for (auto [validate_flag, encoder_flag] : packet_deficiencies) {
|
||||
@ -1960,13 +1941,6 @@ namespace video {
|
||||
BOOST_LOG(warning) << encoder.name << ": hevc missing sps->vui parameters"sv;
|
||||
}
|
||||
|
||||
if (!encoder.h264[encoder_t::NALU_PREFIX_5b]) {
|
||||
BOOST_LOG(warning) << encoder.name << ": h264: replacing nalu prefix data"sv;
|
||||
}
|
||||
if (encoder.hevc[encoder_t::PASSED] && !encoder.hevc[encoder_t::NALU_PREFIX_5b]) {
|
||||
BOOST_LOG(warning) << encoder.name << ": hevc: replacing nalu prefix data"sv;
|
||||
}
|
||||
|
||||
fg.disable();
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user