mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-02 07:11:29 +03:00
update vcpkg to 2024.11.16 (#10272)
1. version changes: * vcpkg: 2024.07.12 -> 2024.11.16 * aom (except linux sciter): 3.9.1 -> 3.11.0 * libvpx: 1.14.1 -> 1.15.0 * libyuv: not update because compiled failed on arm64, and didn't apply different version on different archs * opus: already the latest version * ffmpeg: 7.0.2 -> 7.1 2. other changes: * android 5.0 required, otherwise crash when start, because FFmpeg 7.1 link to mediandk directly 3. Tests: * Except arm, arm64, linux amf, ios, all the other codecs are tested * Compile on arm32 linux is not tested, ci is failed before vcpkg install * Tested windows FFmpeg qsv, still no memory leak Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
From f6988e5424e041ff6f6e241f4d8fa69a04c05e64 Mon Sep 17 00:00:00 2001
|
||||
From da6921d5bcb50961193526f47aa2dbe71ee5fe81 Mon Sep 17 00:00:00 2001
|
||||
From: 21pages <sunboeasy@gmail.com>
|
||||
Date: Thu, 5 Sep 2024 16:26:20 +0800
|
||||
Subject: [PATCH 1/3] avcodec/amfenc: add query_timeout option for h264/hevc
|
||||
Date: Tue, 10 Dec 2024 13:40:46 +0800
|
||||
Subject: [PATCH 1/5] avcodec/amfenc: add query_timeout option for h264/hevc
|
||||
|
||||
Signed-off-by: 21pages <sunboeasy@gmail.com>
|
||||
---
|
||||
@@ -11,10 +11,10 @@ Signed-off-by: 21pages <sunboeasy@gmail.com>
|
||||
3 files changed, 9 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h
|
||||
index 2dbd378ef8..d636673a9d 100644
|
||||
index d985d01bb1..320c66919e 100644
|
||||
--- a/libavcodec/amfenc.h
|
||||
+++ b/libavcodec/amfenc.h
|
||||
@@ -89,6 +89,7 @@ typedef struct AmfContext {
|
||||
@@ -91,6 +91,7 @@ typedef struct AmfContext {
|
||||
int quality;
|
||||
int b_frame_delta_qp;
|
||||
int ref_b_frame_delta_qp;
|
||||
@@ -23,40 +23,40 @@ index 2dbd378ef8..d636673a9d 100644
|
||||
// Dynamic options, can be set after Init() call
|
||||
|
||||
diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
|
||||
index c1d5f4054e..415828f005 100644
|
||||
index 8edd39c633..6ad4961b2f 100644
|
||||
--- a/libavcodec/amfenc_h264.c
|
||||
+++ b/libavcodec/amfenc_h264.c
|
||||
@@ -135,6 +135,7 @@ static const AVOption options[] = {
|
||||
{ "aud", "Inserts AU Delimiter NAL unit", OFFSET(aud) ,AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
||||
@@ -137,6 +137,7 @@ static const AVOption options[] = {
|
||||
|
||||
|
||||
{ "log_to_dbg", "Enable AMF logging to debug output", OFFSET(log_to_dbg) , AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
||||
+ { "query_timeout", "Timeout for QueryOutput call in ms", OFFSET(query_timeout), AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, 1000, VE },
|
||||
|
||||
//Pre Analysis options
|
||||
{ "preanalysis", "Enable preanalysis", OFFSET(preanalysis), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE },
|
||||
@@ -222,6 +223,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
@@ -228,6 +229,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
|
||||
AMF_ASSIGN_PROPERTY_RATE(res, ctx->encoder, AMF_VIDEO_ENCODER_FRAMERATE, framerate);
|
||||
|
||||
+ if (ctx->query_timeout >= 0)
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_QUERY_TIMEOUT, ctx->query_timeout);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_QUERY_TIMEOUT, ctx->query_timeout);
|
||||
+
|
||||
switch (avctx->profile) {
|
||||
case AV_PROFILE_H264_BASELINE:
|
||||
profile = AMF_VIDEO_ENCODER_PROFILE_BASELINE;
|
||||
diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
|
||||
index 33a167aa52..65259d7153 100644
|
||||
index 4898824f3a..22cb95c7ce 100644
|
||||
--- a/libavcodec/amfenc_hevc.c
|
||||
+++ b/libavcodec/amfenc_hevc.c
|
||||
@@ -98,6 +98,7 @@ static const AVOption options[] = {
|
||||
{ "aud", "Inserts AU Delimiter NAL unit", OFFSET(aud) ,AV_OPT_TYPE_BOOL,{ .i64 = 0 }, 0, 1, VE },
|
||||
@@ -104,6 +104,7 @@ static const AVOption options[] = {
|
||||
|
||||
|
||||
{ "log_to_dbg", "Enable AMF logging to debug output", OFFSET(log_to_dbg), AV_OPT_TYPE_BOOL,{ .i64 = 0 }, 0, 1, VE },
|
||||
+ { "query_timeout", "Timeout for QueryOutput call in ms", OFFSET(query_timeout), AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, 1000, VE },
|
||||
|
||||
//Pre Analysis options
|
||||
{ "preanalysis", "Enable preanalysis", OFFSET(preanalysis), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE },
|
||||
@@ -183,6 +184,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
@@ -194,6 +195,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
|
||||
AMF_ASSIGN_PROPERTY_RATE(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_FRAMERATE, framerate);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 6e76c57cf2c0e790228f19c88089eef110fd74aa Mon Sep 17 00:00:00 2001
|
||||
From 8d061adb7b00fc765b8001307c025437ef1cad88 Mon Sep 17 00:00:00 2001
|
||||
From: 21pages <sunboeasy@gmail.com>
|
||||
Date: Thu, 5 Sep 2024 16:32:16 +0800
|
||||
Subject: [PATCH 2/3] libavcodec/amfenc: reconfig when bitrate change
|
||||
Subject: [PATCH 2/5] libavcodec/amfenc: reconfig when bitrate change
|
||||
|
||||
Signed-off-by: 21pages <sunboeasy@gmail.com>
|
||||
---
|
||||
@@ -10,10 +10,10 @@ Signed-off-by: 21pages <sunboeasy@gmail.com>
|
||||
2 files changed, 21 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c
|
||||
index 061859f85c..97587fe66b 100644
|
||||
index a47aea6108..f70f0109f6 100644
|
||||
--- a/libavcodec/amfenc.c
|
||||
+++ b/libavcodec/amfenc.c
|
||||
@@ -222,6 +222,7 @@ static int amf_init_context(AVCodecContext *avctx)
|
||||
@@ -275,6 +275,7 @@ static int amf_init_context(AVCodecContext *avctx)
|
||||
|
||||
ctx->hwsurfaces_in_queue = 0;
|
||||
ctx->hwsurfaces_in_queue_max = 16;
|
||||
@@ -21,7 +21,7 @@ index 061859f85c..97587fe66b 100644
|
||||
|
||||
// configure AMF logger
|
||||
// the return of these functions indicates old state and do not affect behaviour
|
||||
@@ -583,6 +584,23 @@ static void amf_release_buffer_with_frame_ref(AMFBuffer *frame_ref_storage_buffe
|
||||
@@ -640,6 +641,23 @@ static void amf_release_buffer_with_frame_ref(AMFBuffer *frame_ref_storage_buffe
|
||||
frame_ref_storage_buffer->pVtbl->Release(frame_ref_storage_buffer);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ index 061859f85c..97587fe66b 100644
|
||||
int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
|
||||
{
|
||||
AmfContext *ctx = avctx->priv_data;
|
||||
@@ -596,6 +614,8 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
|
||||
@@ -653,6 +671,8 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
|
||||
int query_output_data_flag = 0;
|
||||
AMF_RESULT res_resubmit;
|
||||
|
||||
@@ -55,10 +55,10 @@ index 061859f85c..97587fe66b 100644
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h
|
||||
index d636673a9d..09506ee2e0 100644
|
||||
index 320c66919e..481e0fb75d 100644
|
||||
--- a/libavcodec/amfenc.h
|
||||
+++ b/libavcodec/amfenc.h
|
||||
@@ -113,6 +113,7 @@ typedef struct AmfContext {
|
||||
@@ -115,6 +115,7 @@ typedef struct AmfContext {
|
||||
int max_b_frames;
|
||||
int qvbr_quality_level;
|
||||
int hw_high_motion_quality_boost;
|
||||
|
||||
@@ -1,161 +0,0 @@
|
||||
From 14b77216106eaaff9cf701528039ae4264eaf420 Mon Sep 17 00:00:00 2001
|
||||
From: 21pages <sunboeasy@gmail.com>
|
||||
Date: Thu, 5 Sep 2024 16:41:59 +0800
|
||||
Subject: [PATCH 3/3] amf colorspace
|
||||
|
||||
Signed-off-by: 21pages <sunboeasy@gmail.com>
|
||||
---
|
||||
libavcodec/amfenc.h | 1 +
|
||||
libavcodec/amfenc_h264.c | 40 ++++++++++++++++++++++++++++++++++
|
||||
libavcodec/amfenc_hevc.c | 47 ++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 88 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h
|
||||
index 09506ee2e0..7f458b14f7 100644
|
||||
--- a/libavcodec/amfenc.h
|
||||
+++ b/libavcodec/amfenc.h
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <AMF/components/VideoEncoderVCE.h>
|
||||
#include <AMF/components/VideoEncoderHEVC.h>
|
||||
#include <AMF/components/VideoEncoderAV1.h>
|
||||
+#include <AMF/components/ColorSpace.h>
|
||||
|
||||
#include "libavutil/fifo.h"
|
||||
|
||||
diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
|
||||
index 415828f005..7da5a96c71 100644
|
||||
--- a/libavcodec/amfenc_h264.c
|
||||
+++ b/libavcodec/amfenc_h264.c
|
||||
@@ -200,6 +200,9 @@ static av_cold int amf_encode_init_h264(AVCodecContext *avctx)
|
||||
AMFRate framerate;
|
||||
AMFSize framesize = AMFConstructSize(avctx->width, avctx->height);
|
||||
int deblocking_filter = (avctx->flags & AV_CODEC_FLAG_LOOP_FILTER) ? 1 : 0;
|
||||
+ amf_int64 color_depth;
|
||||
+ amf_int64 color_profile;
|
||||
+ enum AVPixelFormat pix_fmt;
|
||||
|
||||
if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
|
||||
framerate = AMFConstructRate(avctx->framerate.num, avctx->framerate.den);
|
||||
@@ -266,10 +269,47 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
AMF_ASSIGN_PROPERTY_RATIO(res, ctx->encoder, AMF_VIDEO_ENCODER_ASPECT_RATIO, ratio);
|
||||
}
|
||||
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN;
|
||||
/// Color Range (Partial/TV/MPEG or Full/PC/JPEG)
|
||||
if (avctx->color_range == AVCOL_RANGE_JPEG) {
|
||||
AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_FULL_RANGE_COLOR, 1);
|
||||
+ switch (avctx->colorspace) {
|
||||
+ case AVCOL_SPC_SMPTE170M:
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_601;
|
||||
+ break;
|
||||
+ case AVCOL_SPC_BT709:
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_709;
|
||||
+ break;
|
||||
+ case AVCOL_SPC_BT2020_NCL:
|
||||
+ case AVCOL_SPC_BT2020_CL:
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_2020;
|
||||
+ break;
|
||||
+ }
|
||||
+ } else {
|
||||
+ AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_FULL_RANGE_COLOR, 0);
|
||||
+ switch (avctx->colorspace) {
|
||||
+ case AVCOL_SPC_SMPTE170M:
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_601;
|
||||
+ break;
|
||||
+ case AVCOL_SPC_BT709:
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_709;
|
||||
+ break;
|
||||
+ case AVCOL_SPC_BT2020_NCL:
|
||||
+ case AVCOL_SPC_BT2020_CL:
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_2020;
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
+ pix_fmt = avctx->hw_frames_ctx ? ((AVHWFramesContext*)avctx->hw_frames_ctx->data)->sw_format : avctx->pix_fmt;
|
||||
+ color_depth = AMF_COLOR_BIT_DEPTH_8;
|
||||
+ if (pix_fmt == AV_PIX_FMT_P010) {
|
||||
+ color_depth = AMF_COLOR_BIT_DEPTH_10;
|
||||
+ }
|
||||
+
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_COLOR_BIT_DEPTH, color_depth);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_OUTPUT_COLOR_PROFILE, color_profile);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_OUTPUT_TRANSFER_CHARACTERISTIC, (amf_int64)avctx->color_trc);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_OUTPUT_COLOR_PRIMARIES, (amf_int64)avctx->color_primaries);
|
||||
|
||||
// autodetect rate control method
|
||||
if (ctx->rate_control_mode == AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_UNKNOWN) {
|
||||
diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
|
||||
index 65259d7153..7c930d3ccc 100644
|
||||
--- a/libavcodec/amfenc_hevc.c
|
||||
+++ b/libavcodec/amfenc_hevc.c
|
||||
@@ -161,6 +161,9 @@ static av_cold int amf_encode_init_hevc(AVCodecContext *avctx)
|
||||
AMFRate framerate;
|
||||
AMFSize framesize = AMFConstructSize(avctx->width, avctx->height);
|
||||
int deblocking_filter = (avctx->flags & AV_CODEC_FLAG_LOOP_FILTER) ? 1 : 0;
|
||||
+ amf_int64 color_depth;
|
||||
+ amf_int64 color_profile;
|
||||
+ enum AVPixelFormat pix_fmt;
|
||||
|
||||
if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
|
||||
framerate = AMFConstructRate(avctx->framerate.num, avctx->framerate.den);
|
||||
@@ -191,6 +194,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
case AV_PROFILE_HEVC_MAIN:
|
||||
profile = AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN;
|
||||
break;
|
||||
+ case AV_PROFILE_HEVC_MAIN_10:
|
||||
+ profile = AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN_10;
|
||||
+ break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -219,6 +225,47 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
AMF_ASSIGN_PROPERTY_RATIO(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_ASPECT_RATIO, ratio);
|
||||
}
|
||||
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN;
|
||||
+ if (avctx->color_range == AVCOL_RANGE_JPEG) {
|
||||
+ AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_NOMINAL_RANGE, 1);
|
||||
+ switch (avctx->colorspace) {
|
||||
+ case AVCOL_SPC_SMPTE170M:
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_601;
|
||||
+ break;
|
||||
+ case AVCOL_SPC_BT709:
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_709;
|
||||
+ break;
|
||||
+ case AVCOL_SPC_BT2020_NCL:
|
||||
+ case AVCOL_SPC_BT2020_CL:
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_2020;
|
||||
+ break;
|
||||
+ }
|
||||
+ } else {
|
||||
+ AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_NOMINAL_RANGE, 0);
|
||||
+ switch (avctx->colorspace) {
|
||||
+ case AVCOL_SPC_SMPTE170M:
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_601;
|
||||
+ break;
|
||||
+ case AVCOL_SPC_BT709:
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_709;
|
||||
+ break;
|
||||
+ case AVCOL_SPC_BT2020_NCL:
|
||||
+ case AVCOL_SPC_BT2020_CL:
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_2020;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ pix_fmt = avctx->hw_frames_ctx ? ((AVHWFramesContext*)avctx->hw_frames_ctx->data)->sw_format : avctx->pix_fmt;
|
||||
+ color_depth = AMF_COLOR_BIT_DEPTH_8;
|
||||
+ if (pix_fmt == AV_PIX_FMT_P010) {
|
||||
+ color_depth = AMF_COLOR_BIT_DEPTH_10;
|
||||
+ }
|
||||
+
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_COLOR_BIT_DEPTH, color_depth);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_OUTPUT_COLOR_PROFILE, color_profile);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_OUTPUT_TRANSFER_CHARACTERISTIC, (amf_int64)avctx->color_trc);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_OUTPUT_COLOR_PRIMARIES, (amf_int64)avctx->color_primaries);
|
||||
+
|
||||
// Picture control properties
|
||||
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_NUM_GOPS_PER_IDR, ctx->gops_per_idr);
|
||||
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_GOP_SIZE, avctx->gop_size);
|
||||
--
|
||||
2.43.0.windows.1
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
From 7f12898fe8fd12c1042c98b34825ab2eda89e54d Mon Sep 17 00:00:00 2001
|
||||
From d74de94b49efcf7a0b25673ace6016938d1b9272 Mon Sep 17 00:00:00 2001
|
||||
From: 21pages <sunboeasy@gmail.com>
|
||||
Date: Sun, 24 Nov 2024 12:58:39 +0800
|
||||
Subject: [PATCH 1/2] videotoolbox changing bitrate
|
||||
Date: Tue, 10 Dec 2024 14:12:01 +0800
|
||||
Subject: [PATCH 3/5] videotoolbox changing bitrate
|
||||
|
||||
Signed-off-by: 21pages <sunboeasy@gmail.com>
|
||||
---
|
||||
libavcodec/videotoolboxenc.c | 39 ++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 39 insertions(+)
|
||||
libavcodec/videotoolboxenc.c | 40 ++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 40 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
|
||||
index 5ea9afee22..89c927cdcc 100644
|
||||
index da7b291b03..3c866177f5 100644
|
||||
--- a/libavcodec/videotoolboxenc.c
|
||||
+++ b/libavcodec/videotoolboxenc.c
|
||||
@@ -278,6 +278,8 @@ typedef struct VTEncContext {
|
||||
@@ -279,6 +279,8 @@ typedef struct VTEncContext {
|
||||
int max_slice_bytes;
|
||||
int power_efficient;
|
||||
int max_ref_frames;
|
||||
@@ -20,8 +20,8 @@ index 5ea9afee22..89c927cdcc 100644
|
||||
+ int last_bit_rate;
|
||||
} VTEncContext;
|
||||
|
||||
static int vt_dump_encoder(AVCodecContext *avctx)
|
||||
@@ -1174,6 +1176,7 @@ static int vtenc_create_encoder(AVCodecContext *avctx,
|
||||
static void vtenc_free_buf_node(BufNode *info)
|
||||
@@ -1180,6 +1182,7 @@ static int vtenc_create_encoder(AVCodecContext *avctx,
|
||||
int64_t one_second_value = 0;
|
||||
void *nums[2];
|
||||
|
||||
@@ -29,8 +29,8 @@ index 5ea9afee22..89c927cdcc 100644
|
||||
int status = VTCompressionSessionCreate(kCFAllocatorDefault,
|
||||
avctx->width,
|
||||
avctx->height,
|
||||
@@ -2618,6 +2621,41 @@ static int vtenc_send_frame(AVCodecContext *avctx,
|
||||
return 0;
|
||||
@@ -2638,6 +2641,42 @@ out:
|
||||
return status;
|
||||
}
|
||||
|
||||
+static void update_config(AVCodecContext *avctx)
|
||||
@@ -67,13 +67,14 @@ index 5ea9afee22..89c927cdcc 100644
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
static av_cold int vtenc_frame(
|
||||
AVCodecContext *avctx,
|
||||
AVPacket *pkt,
|
||||
@@ -2630,6 +2668,7 @@ static av_cold int vtenc_frame(
|
||||
@@ -2650,6 +2689,7 @@ static av_cold int vtenc_frame(
|
||||
CMSampleBufferRef buf = NULL;
|
||||
ExtraSEI *sei = NULL;
|
||||
ExtraSEI sei = {0};
|
||||
|
||||
+ update_config(avctx);
|
||||
if (frame) {
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
From ed73f8f6494d74ae47218f9503c7e3de385d9253 Mon Sep 17 00:00:00 2001
|
||||
From 7323bd68c1b34e9298ea557ff7a3e1883b653957 Mon Sep 17 00:00:00 2001
|
||||
From: 21pages <sunboeasy@gmail.com>
|
||||
Date: Sun, 24 Nov 2024 14:17:39 +0800
|
||||
Subject: [PATCH 1/2] mediacodec changing bitrate
|
||||
Date: Tue, 10 Dec 2024 14:28:16 +0800
|
||||
Subject: [PATCH 4/5] mediacodec changing bitrate
|
||||
|
||||
Signed-off-by: 21pages <sunboeasy@gmail.com>
|
||||
---
|
||||
libavcodec/mediacodec_wrapper.c | 97 +++++++++++++++++++++++++++++++++
|
||||
libavcodec/mediacodec_wrapper.c | 98 +++++++++++++++++++++++++++++++++
|
||||
libavcodec/mediacodec_wrapper.h | 7 +++
|
||||
libavcodec/mediacodecenc.c | 18 ++++++
|
||||
3 files changed, 122 insertions(+)
|
||||
3 files changed, 123 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
|
||||
index 306359071e..7edb38a7d7 100644
|
||||
index 96c886666a..06b8504304 100644
|
||||
--- a/libavcodec/mediacodec_wrapper.c
|
||||
+++ b/libavcodec/mediacodec_wrapper.c
|
||||
@@ -35,6 +35,8 @@
|
||||
@@ -66,10 +66,11 @@ index 306359071e..7edb38a7d7 100644
|
||||
#define JNI_GET_ENV_OR_RETURN(env, log_ctx, ret) do { \
|
||||
(env) = ff_jni_get_env(log_ctx); \
|
||||
if (!(env)) { \
|
||||
@@ -1761,6 +1785,69 @@ static int mediacodec_jni_signalEndOfInputStream(FFAMediaCodec *ctx)
|
||||
@@ -1762,6 +1786,70 @@ static int mediacodec_jni_signalEndOfInputStream(FFAMediaCodec *ctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+
|
||||
+static int mediacodec_jni_setParameter(FFAMediaCodec *ctx, const char* name, int value)
|
||||
+{
|
||||
+ JNIEnv *env = NULL;
|
||||
@@ -136,7 +137,7 @@ index 306359071e..7edb38a7d7 100644
|
||||
static const FFAMediaFormat media_format_jni = {
|
||||
.class = &amediaformat_class,
|
||||
|
||||
@@ -1820,6 +1907,8 @@ static const FFAMediaCodec media_codec_jni = {
|
||||
@@ -1821,6 +1909,8 @@ static const FFAMediaCodec media_codec_jni = {
|
||||
.getConfigureFlagEncode = mediacodec_jni_getConfigureFlagEncode,
|
||||
.cleanOutputBuffers = mediacodec_jni_cleanOutputBuffers,
|
||||
.signalEndOfInputStream = mediacodec_jni_signalEndOfInputStream,
|
||||
@@ -145,7 +146,7 @@ index 306359071e..7edb38a7d7 100644
|
||||
};
|
||||
|
||||
typedef struct FFAMediaFormatNdk {
|
||||
@@ -2428,6 +2517,12 @@ static int mediacodec_ndk_signalEndOfInputStream(FFAMediaCodec *ctx)
|
||||
@@ -2335,6 +2425,12 @@ static int mediacodec_ndk_signalEndOfInputStream(FFAMediaCodec *ctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -158,7 +159,7 @@ index 306359071e..7edb38a7d7 100644
|
||||
static const FFAMediaFormat media_format_ndk = {
|
||||
.class = &amediaformat_ndk_class,
|
||||
|
||||
@@ -2489,6 +2584,8 @@ static const FFAMediaCodec media_codec_ndk = {
|
||||
@@ -2396,6 +2492,8 @@ static const FFAMediaCodec media_codec_ndk = {
|
||||
.getConfigureFlagEncode = mediacodec_ndk_getConfigureFlagEncode,
|
||||
.cleanOutputBuffers = mediacodec_ndk_cleanOutputBuffers,
|
||||
.signalEndOfInputStream = mediacodec_ndk_signalEndOfInputStream,
|
||||
@@ -193,19 +194,19 @@ index 11a4260497..86c64556ad 100644
|
||||
|
||||
enum FFAMediaFormatColorRange {
|
||||
diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c
|
||||
index d3bf27cb7f..621529d686 100644
|
||||
index 6ca3968a24..221f7360f4 100644
|
||||
--- a/libavcodec/mediacodecenc.c
|
||||
+++ b/libavcodec/mediacodecenc.c
|
||||
@@ -73,6 +73,8 @@ typedef struct MediaCodecEncContext {
|
||||
int bitrate_mode;
|
||||
@@ -76,6 +76,8 @@ typedef struct MediaCodecEncContext {
|
||||
int level;
|
||||
int pts_as_dts;
|
||||
int extract_extradata;
|
||||
+
|
||||
+ int last_bit_rate;
|
||||
} MediaCodecEncContext;
|
||||
|
||||
enum {
|
||||
@@ -155,6 +157,8 @@ static av_cold int mediacodec_init(AVCodecContext *avctx)
|
||||
@@ -193,6 +195,8 @@ static av_cold int mediacodec_init(AVCodecContext *avctx)
|
||||
int ret;
|
||||
int gop;
|
||||
|
||||
@@ -214,7 +215,7 @@ index d3bf27cb7f..621529d686 100644
|
||||
if (s->use_ndk_codec < 0)
|
||||
s->use_ndk_codec = !av_jni_get_java_vm(avctx);
|
||||
|
||||
@@ -515,12 +519,26 @@ static int mediacodec_send(AVCodecContext *avctx,
|
||||
@@ -542,11 +546,25 @@ static int mediacodec_send(AVCodecContext *avctx,
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -235,12 +236,11 @@ index d3bf27cb7f..621529d686 100644
|
||||
{
|
||||
MediaCodecEncContext *s = avctx->priv_data;
|
||||
int ret;
|
||||
int got_packet = 0;
|
||||
|
||||
+ update_config(avctx);
|
||||
// Return on three case:
|
||||
// 1. Serious error
|
||||
// 2. Got a packet success
|
||||
--
|
||||
2.34.1
|
||||
2.43.0.windows.1
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
30
res/vcpkg/ffmpeg/patch/0007-fix-linux-configure.patch
Normal file
30
res/vcpkg/ffmpeg/patch/0007-fix-linux-configure.patch
Normal file
@@ -0,0 +1,30 @@
|
||||
From 595f0468e127f204741b6c37a479d71daaf571eb Mon Sep 17 00:00:00 2001
|
||||
From: 21pages <sunboeasy@gmail.com>
|
||||
Date: Tue, 10 Dec 2024 21:17:14 +0800
|
||||
Subject: [PATCH] fix linux configure
|
||||
|
||||
Signed-off-by: 21pages <sunboeasy@gmail.com>
|
||||
---
|
||||
configure | 6 ------
|
||||
1 file changed, 6 deletions(-)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index d77a55b653..48ca90ac5e 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -7071,12 +7071,6 @@ enabled mmal && { check_lib mmal interface/mmal/mmal.h mmal_port_co
|
||||
check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } ||
|
||||
die "ERROR: mmal not found" &&
|
||||
check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; }
|
||||
-enabled openal && { check_pkg_config openal "openal >= 1.1" "AL/al.h" alGetError ||
|
||||
- { for al_extralibs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
|
||||
- check_lib openal 'AL/al.h' alGetError "${al_extralibs}" && break; done } ||
|
||||
- die "ERROR: openal not found"; } &&
|
||||
- { test_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
|
||||
- die "ERROR: openal must be installed and version must be 1.1 or compatible"; }
|
||||
enabled opencl && { check_pkg_config opencl OpenCL CL/cl.h clEnqueueNDRangeKernel ||
|
||||
check_lib opencl OpenCL/cl.h clEnqueueNDRangeKernel "-framework OpenCL" ||
|
||||
check_lib opencl CL/cl.h clEnqueueNDRangeKernel -lOpenCL ||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
Reference in New Issue
Block a user