diff --git a/cmake/dependencies/common.cmake b/cmake/dependencies/common.cmake index c92b4777..97319be6 100644 --- a/cmake/dependencies/common.cmake +++ b/cmake/dependencies/common.cmake @@ -51,10 +51,10 @@ if(NOT DEFINED FFMPEG_PREPARED_BINARIES) endif() set(FFMPEG_LIBRARIES "${FFMPEG_PREPARED_BINARIES}/lib/libavcodec.a" + "${FFMPEG_PREPARED_BINARIES}/lib/libswscale.a" "${FFMPEG_PREPARED_BINARIES}/lib/libavutil.a" "${FFMPEG_PREPARED_BINARIES}/lib/libcbs.a" "${FFMPEG_PREPARED_BINARIES}/lib/libSvtAv1Enc.a" - "${FFMPEG_PREPARED_BINARIES}/lib/libswscale.a" "${FFMPEG_PREPARED_BINARIES}/lib/libx264.a" "${FFMPEG_PREPARED_BINARIES}/lib/libx265.a" ${HDR10_PLUS_LIBRARY} @@ -62,9 +62,9 @@ if(NOT DEFINED FFMPEG_PREPARED_BINARIES) else() set(FFMPEG_LIBRARIES "${FFMPEG_PREPARED_BINARIES}/lib/libavcodec.a" + "${FFMPEG_PREPARED_BINARIES}/lib/libswscale.a" "${FFMPEG_PREPARED_BINARIES}/lib/libavutil.a" "${FFMPEG_PREPARED_BINARIES}/lib/libcbs.a" - "${FFMPEG_PREPARED_BINARIES}/lib/libswscale.a" ${FFMPEG_PLATFORM_LIBRARIES}) endif() diff --git a/src/platform/linux/vaapi.cpp b/src/platform/linux/vaapi.cpp index 1a38c4ec..e0cc7930 100644 --- a/src/platform/linux/vaapi.cpp +++ b/src/platform/linux/vaapi.cpp @@ -191,7 +191,7 @@ namespace va { return VAProfileH264High; } else if (ctx->codec_id == AV_CODEC_ID_HEVC) { switch (ctx->profile) { - case FF_PROFILE_HEVC_REXT: + case AV_PROFILE_HEVC_REXT: switch (av_pix_fmt_desc_get(ctx->sw_pix_fmt)->comp[0].depth) { case 10: return VAProfileHEVCMain444_10; @@ -199,16 +199,16 @@ namespace va { return VAProfileHEVCMain444; } break; - case FF_PROFILE_HEVC_MAIN_10: + case AV_PROFILE_HEVC_MAIN_10: return VAProfileHEVCMain10; - case FF_PROFILE_HEVC_MAIN: + case AV_PROFILE_HEVC_MAIN: return VAProfileHEVCMain; } } else if (ctx->codec_id == AV_CODEC_ID_AV1) { switch (ctx->profile) { - case FF_PROFILE_AV1_HIGH: + case AV_PROFILE_AV1_HIGH: return VAProfileAV1Profile1; - case FF_PROFILE_AV1_MAIN: + case AV_PROFILE_AV1_MAIN: return VAProfileAV1Profile0; } } diff --git a/src/video.cpp b/src/video.cpp index 4db957b3..8f6b69c4 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -315,6 +315,12 @@ namespace video { avcodec_encode_session_t(avcodec_encode_session_t &&other) noexcept = default; ~avcodec_encode_session_t() { + // Flush any remaining frames in the encoder + if (avcodec_send_frame(avcodec_ctx.get(), nullptr) == 0) { + packet_raw_avcodec pkt; + while (avcodec_receive_packet(avcodec_ctx.get(), pkt.av_packet) == 0); + } + // Order matters here because the context relies on the hwdevice still being valid avcodec_ctx.reset(); device.reset(); @@ -536,7 +542,7 @@ namespace video { {"forced-idr"s, 1}, {"zerolatency"s, 1}, {"surfaces"s, 1}, - {"filler_data"s, false}, + {"cbr_padding"s, false}, {"preset"s, &config::video.nv_legacy.preset}, {"tune"s, NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY}, {"rc"s, NV_ENC_PARAMS_RC_CBR}, @@ -557,6 +563,7 @@ namespace video { {"forced-idr"s, 1}, {"zerolatency"s, 1}, {"surfaces"s, 1}, + {"cbr_padding"s, false}, {"preset"s, &config::video.nv_legacy.preset}, {"tune"s, NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY}, {"rc"s, NV_ENC_PARAMS_RC_CBR}, @@ -582,6 +589,7 @@ namespace video { {"forced-idr"s, 1}, {"zerolatency"s, 1}, {"surfaces"s, 1}, + {"cbr_padding"s, false}, {"preset"s, &config::video.nv_legacy.preset}, {"tune"s, NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY}, {"rc"s, NV_ENC_PARAMS_RC_CBR}, @@ -730,6 +738,7 @@ namespace video { {"filler_data"s, false}, {"forced_idr"s, 1}, {"latency"s, "lowest_latency"s}, + {"async_depth"s, 1}, {"skip_frame"s, 0}, {"log_to_dbg"s, []() { return config::sunshine.min_log_level < 2 ? 1 : 0; @@ -753,6 +762,7 @@ namespace video { {"filler_data"s, false}, {"forced_idr"s, 1}, {"latency"s, 1}, + {"async_depth"s, 1}, {"skip_frame"s, 0}, {"log_to_dbg"s, []() { return config::sunshine.min_log_level < 2 ? 1 : 0; @@ -791,6 +801,7 @@ namespace video { {"filler_data"s, false}, {"forced_idr"s, 1}, {"latency"s, 1}, + {"async_depth"s, 1}, {"frame_skipping"s, 0}, {"log_to_dbg"s, []() { return config::sunshine.min_log_level < 2 ? 1 : 0; @@ -1526,22 +1537,22 @@ namespace video { case 0: // 10-bit h264 encoding is not supported by our streaming protocol assert(!config.dynamicRange); - ctx->profile = (config.chromaSamplingType == 1) ? FF_PROFILE_H264_HIGH_444_PREDICTIVE : FF_PROFILE_H264_HIGH; + ctx->profile = (config.chromaSamplingType == 1) ? AV_PROFILE_H264_HIGH_444_PREDICTIVE : AV_PROFILE_H264_HIGH; break; case 1: if (config.chromaSamplingType == 1) { // HEVC uses the same RExt profile for both 8 and 10 bit YUV 4:4:4 encoding - ctx->profile = FF_PROFILE_HEVC_REXT; + ctx->profile = AV_PROFILE_HEVC_REXT; } else { - ctx->profile = config.dynamicRange ? FF_PROFILE_HEVC_MAIN_10 : FF_PROFILE_HEVC_MAIN; + ctx->profile = config.dynamicRange ? AV_PROFILE_HEVC_MAIN_10 : AV_PROFILE_HEVC_MAIN; } break; case 2: // AV1 supports both 8 and 10 bit encoding with the same Main profile // but YUV 4:4:4 sampling requires High profile - ctx->profile = (config.chromaSamplingType == 1) ? FF_PROFILE_AV1_HIGH : FF_PROFILE_AV1_MAIN; + ctx->profile = (config.chromaSamplingType == 1) ? AV_PROFILE_AV1_HIGH : AV_PROFILE_AV1_MAIN; break; } diff --git a/third-party/build-deps b/third-party/build-deps index 94369e63..a21ef2e3 160000 --- a/third-party/build-deps +++ b/third-party/build-deps @@ -1 +1 @@ -Subproject commit 94369e63776e3a018df0bdb82992d1a7ba98adf7 +Subproject commit a21ef2e30031628d9e1be3ae250b53d84726cbd8