* [FFmpeg-devel] [PATCH 02/10] avformat/vivo: fix sscanf specifer for double
2025-07-22 19:16 [FFmpeg-devel] [PATCH 01/10] avformat/os_support: check invalid socket value correctly on Windows Kacper Michajłow
@ 2025-07-22 19:16 ` Kacper Michajłow
2025-07-22 19:16 ` [FFmpeg-devel] [PATCH 03/10] avcodec/d3d12va_decode: remove unused variable Kacper Michajłow
` (7 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Kacper Michajłow @ 2025-07-22 19:16 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Kacper Michajłow
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
libavformat/vivo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/vivo.c b/libavformat/vivo.c
index 76aa4a21c2..c20788f8bb 100644
--- a/libavformat/vivo.c
+++ b/libavformat/vivo.c
@@ -209,7 +209,7 @@ static int vivo_read_header(AVFormatContext *s)
value_used = 1;
} else if (!strcmp(key, "FPS")) {
double d;
- if (av_sscanf(value, "%f", &d) != 1)
+ if (av_sscanf(value, "%lf", &d) != 1)
return AVERROR_INVALIDDATA;
value_used = 1;
--
2.50.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 11+ messages in thread
* [FFmpeg-devel] [PATCH 03/10] avcodec/d3d12va_decode: remove unused variable
2025-07-22 19:16 [FFmpeg-devel] [PATCH 01/10] avformat/os_support: check invalid socket value correctly on Windows Kacper Michajłow
2025-07-22 19:16 ` [FFmpeg-devel] [PATCH 02/10] avformat/vivo: fix sscanf specifer for double Kacper Michajłow
@ 2025-07-22 19:16 ` Kacper Michajłow
2025-07-22 19:16 ` [FFmpeg-devel] [PATCH 04/10] avcodec/d3d12va_encode: use correct none flag Kacper Michajłow
` (6 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Kacper Michajłow @ 2025-07-22 19:16 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Kacper Michajłow
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
libavcodec/d3d12va_decode.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/libavcodec/d3d12va_decode.c b/libavcodec/d3d12va_decode.c
index 4645ffe122..4e714efb1a 100644
--- a/libavcodec/d3d12va_decode.c
+++ b/libavcodec/d3d12va_decode.c
@@ -50,7 +50,6 @@ typedef struct ReferenceFrame {
static ID3D12Resource *get_reference_only_resource(AVCodecContext *avctx, ID3D12Resource *output_resource)
{
D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx);
- AVHWFramesContext *frames_ctx = D3D12VA_FRAMES_CONTEXT(avctx);
AVD3D12VADeviceContext *device_hwctx = ctx->device_ctx;
int i = 0;
ID3D12Resource *resource = NULL;
--
2.50.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 11+ messages in thread
* [FFmpeg-devel] [PATCH 04/10] avcodec/d3d12va_encode: use correct none flag
2025-07-22 19:16 [FFmpeg-devel] [PATCH 01/10] avformat/os_support: check invalid socket value correctly on Windows Kacper Michajłow
2025-07-22 19:16 ` [FFmpeg-devel] [PATCH 02/10] avformat/vivo: fix sscanf specifer for double Kacper Michajłow
2025-07-22 19:16 ` [FFmpeg-devel] [PATCH 03/10] avcodec/d3d12va_decode: remove unused variable Kacper Michajłow
@ 2025-07-22 19:16 ` Kacper Michajłow
2025-07-22 19:16 ` [FFmpeg-devel] [PATCH 05/10] avcodec/d3d12va_encode: don't write garbage when there is no header Kacper Michajłow
` (5 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Kacper Michajłow @ 2025-07-22 19:16 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Kacper Michajłow
NFC, it's still 0, but correct enum type so compilers won't complain.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
libavcodec/d3d12va_encode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/d3d12va_encode.c b/libavcodec/d3d12va_encode.c
index e24a5b8d24..d99e960db6 100644
--- a/libavcodec/d3d12va_encode.c
+++ b/libavcodec/d3d12va_encode.c
@@ -1154,7 +1154,7 @@ static int d3d12va_create_encoder_heap(AVCodecContext *avctx)
D3D12_VIDEO_ENCODER_HEAP_DESC desc = {
.NodeMask = 0,
- .Flags = D3D12_VIDEO_ENCODER_FLAG_NONE,
+ .Flags = D3D12_VIDEO_ENCODER_HEAP_FLAG_NONE,
.EncodeCodec = ctx->codec->d3d12_codec,
.EncodeProfile = ctx->profile->d3d12_profile,
.EncodeLevel = ctx->level,
--
2.50.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 11+ messages in thread
* [FFmpeg-devel] [PATCH 05/10] avcodec/d3d12va_encode: don't write garbage when there is no header
2025-07-22 19:16 [FFmpeg-devel] [PATCH 01/10] avformat/os_support: check invalid socket value correctly on Windows Kacper Michajłow
` (2 preceding siblings ...)
2025-07-22 19:16 ` [FFmpeg-devel] [PATCH 04/10] avcodec/d3d12va_encode: use correct none flag Kacper Michajłow
@ 2025-07-22 19:16 ` Kacper Michajłow
2025-07-22 19:16 ` [FFmpeg-devel] [PATCH 06/10] avcodec/d3d12va_encode: don't return uninitialized value on error Kacper Michajłow
` (4 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Kacper Michajłow @ 2025-07-22 19:16 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Kacper Michajłow
When codec->write_sequence_header is not defined, bit_len was undefined,
and while data bufer was zeroed we could just overread it. Do nothing
when we don't have anything to write.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
libavcodec/d3d12va_encode.c | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/libavcodec/d3d12va_encode.c b/libavcodec/d3d12va_encode.c
index d99e960db6..64821da5f5 100644
--- a/libavcodec/d3d12va_encode.c
+++ b/libavcodec/d3d12va_encode.c
@@ -299,21 +299,20 @@ static int d3d12va_encode_issue(AVCodecContext *avctx,
"header: %d.\n", err);
goto fail;
}
- }
-
- pic->header_size = (int)bit_len / 8;
- pic->aligned_header_size = pic->header_size % ctx->req.CompressedBitstreamBufferAccessAlignment ?
- FFALIGN(pic->header_size, ctx->req.CompressedBitstreamBufferAccessAlignment) :
- pic->header_size;
+ pic->header_size = (int)bit_len / 8;
+ pic->aligned_header_size = pic->header_size % ctx->req.CompressedBitstreamBufferAccessAlignment ?
+ FFALIGN(pic->header_size, ctx->req.CompressedBitstreamBufferAccessAlignment) :
+ pic->header_size;
+
+ hr = ID3D12Resource_Map(pic->output_buffer, 0, NULL, (void **)&ptr);
+ if (FAILED(hr)) {
+ err = AVERROR_UNKNOWN;
+ goto fail;
+ }
- hr = ID3D12Resource_Map(pic->output_buffer, 0, NULL, (void **)&ptr);
- if (FAILED(hr)) {
- err = AVERROR_UNKNOWN;
- goto fail;
+ memcpy(ptr, data, pic->aligned_header_size);
+ ID3D12Resource_Unmap(pic->output_buffer, 0, NULL);
}
-
- memcpy(ptr, data, pic->aligned_header_size);
- ID3D12Resource_Unmap(pic->output_buffer, 0, NULL);
}
d3d12_refs.NumTexture2Ds = base_pic->nb_refs[0] + base_pic->nb_refs[1];
--
2.50.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 11+ messages in thread
* [FFmpeg-devel] [PATCH 06/10] avcodec/d3d12va_encode: don't return uninitialized value on error
2025-07-22 19:16 [FFmpeg-devel] [PATCH 01/10] avformat/os_support: check invalid socket value correctly on Windows Kacper Michajłow
` (3 preceding siblings ...)
2025-07-22 19:16 ` [FFmpeg-devel] [PATCH 05/10] avcodec/d3d12va_encode: don't write garbage when there is no header Kacper Michajłow
@ 2025-07-22 19:16 ` Kacper Michajłow
2025-07-22 19:16 ` [FFmpeg-devel] [PATCH 07/10] avcodec/d3d12va_encode_hevc: remove unused variable Kacper Michajłow
` (3 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Kacper Michajłow @ 2025-07-22 19:16 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Kacper Michajłow
When CreateEvent fails, err was not initialized.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
libavcodec/d3d12va_encode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/d3d12va_encode.c b/libavcodec/d3d12va_encode.c
index 64821da5f5..880002ce55 100644
--- a/libavcodec/d3d12va_encode.c
+++ b/libavcodec/d3d12va_encode.c
@@ -1265,7 +1265,7 @@ static int d3d12va_encode_create_command_objects(AVCodecContext *avctx)
{
D3D12VAEncodeContext *ctx = avctx->priv_data;
ID3D12CommandAllocator *command_allocator = NULL;
- int err;
+ int err = AVERROR_UNKNOWN;
HRESULT hr;
D3D12_COMMAND_QUEUE_DESC queue_desc = {
--
2.50.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 11+ messages in thread
* [FFmpeg-devel] [PATCH 07/10] avcodec/d3d12va_encode_hevc: remove unused variable
2025-07-22 19:16 [FFmpeg-devel] [PATCH 01/10] avformat/os_support: check invalid socket value correctly on Windows Kacper Michajłow
` (4 preceding siblings ...)
2025-07-22 19:16 ` [FFmpeg-devel] [PATCH 06/10] avcodec/d3d12va_encode: don't return uninitialized value on error Kacper Michajłow
@ 2025-07-22 19:16 ` Kacper Michajłow
2025-07-22 19:16 ` [FFmpeg-devel] [PATCH 08/10] avcodec/x86/fdct: guard usage of undefined functions with preprocessor Kacper Michajłow
` (2 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Kacper Michajłow @ 2025-07-22 19:16 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Kacper Michajłow
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
libavcodec/d3d12va_encode_hevc.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/libavcodec/d3d12va_encode_hevc.c b/libavcodec/d3d12va_encode_hevc.c
index 938ba01f54..ce5d1bf110 100644
--- a/libavcodec/d3d12va_encode_hevc.c
+++ b/libavcodec/d3d12va_encode_hevc.c
@@ -238,7 +238,6 @@ static int d3d12va_encode_hevc_init_sequence_params(AVCodecContext *avctx)
AVD3D12VAFramesContext *hwctx = base_ctx->input_frames->hwctx;
H265RawSPS *sps = &priv->units.raw_sps;
H265RawPPS *pps = &priv->units.raw_pps;
- H265RawVUI *vui = &sps->vui;
D3D12_VIDEO_ENCODER_PROFILE_HEVC profile = D3D12_VIDEO_ENCODER_PROFILE_HEVC_MAIN;
D3D12_VIDEO_ENCODER_LEVEL_TIER_CONSTRAINTS_HEVC level = { 0 };
const AVPixFmtDescriptor *desc;
--
2.50.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 11+ messages in thread
* [FFmpeg-devel] [PATCH 08/10] avcodec/x86/fdct: guard usage of undefined functions with preprocessor
2025-07-22 19:16 [FFmpeg-devel] [PATCH 01/10] avformat/os_support: check invalid socket value correctly on Windows Kacper Michajłow
` (5 preceding siblings ...)
2025-07-22 19:16 ` [FFmpeg-devel] [PATCH 07/10] avcodec/d3d12va_encode_hevc: remove unused variable Kacper Michajłow
@ 2025-07-22 19:16 ` Kacper Michajłow
2025-07-22 19:27 ` Kacper Michajlow
2025-07-22 19:16 ` [FFmpeg-devel] [PATCH 09/10] avcodec/x86/vc1: " Kacper Michajłow
2025-07-22 19:16 ` [FFmpeg-devel] [PATCH 10/10] avformat/rtmpproto: " Kacper Michajłow
8 siblings, 1 reply; 11+ messages in thread
From: Kacper Michajłow @ 2025-07-22 19:16 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Kacper Michajłow
The asumption is that DCE will remove references to those functions.
However some compilers with certain instrumentation enabled doesn't DCE
those at all, resulting in linking failure. Tested with cl.exe -RTCu -RTCs.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
libavcodec/x86/fdctdsp_init.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libavcodec/x86/fdctdsp_init.c b/libavcodec/x86/fdctdsp_init.c
index 92a842433d..d43e45d220 100644
--- a/libavcodec/x86/fdctdsp_init.c
+++ b/libavcodec/x86/fdctdsp_init.c
@@ -31,8 +31,10 @@ av_cold void ff_fdctdsp_init_x86(FDCTDSPContext *c, AVCodecContext *avctx,
if (!high_bit_depth) {
if ((dct_algo == FF_DCT_AUTO || dct_algo == FF_DCT_MMX)) {
+#if HAVE_SSE2_INLINE
if (INLINE_SSE2(cpu_flags))
c->fdct = ff_fdct_sse2;
+#endif
}
}
}
--
2.50.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [FFmpeg-devel] [PATCH 08/10] avcodec/x86/fdct: guard usage of undefined functions with preprocessor
2025-07-22 19:16 ` [FFmpeg-devel] [PATCH 08/10] avcodec/x86/fdct: guard usage of undefined functions with preprocessor Kacper Michajłow
@ 2025-07-22 19:27 ` Kacper Michajlow
0 siblings, 0 replies; 11+ messages in thread
From: Kacper Michajlow @ 2025-07-22 19:27 UTC (permalink / raw)
To: ffmpeg-devel
On Tue, 22 Jul 2025 at 21:16, Kacper Michajłow <kasper93@gmail.com> wrote:
>
> The asumption is that DCE will remove references to those functions.
> However some compilers with certain instrumentation enabled doesn't DCE
> those at all, resulting in linking failure. Tested with cl.exe -RTCu -RTCs.
>
> Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
> ---
> libavcodec/x86/fdctdsp_init.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/libavcodec/x86/fdctdsp_init.c b/libavcodec/x86/fdctdsp_init.c
> index 92a842433d..d43e45d220 100644
> --- a/libavcodec/x86/fdctdsp_init.c
> +++ b/libavcodec/x86/fdctdsp_init.c
> @@ -31,8 +31,10 @@ av_cold void ff_fdctdsp_init_x86(FDCTDSPContext *c, AVCodecContext *avctx,
>
> if (!high_bit_depth) {
> if ((dct_algo == FF_DCT_AUTO || dct_algo == FF_DCT_MMX)) {
> +#if HAVE_SSE2_INLINE
> if (INLINE_SSE2(cpu_flags))
> c->fdct = ff_fdct_sse2;
> +#endif
> }
> }
> }
> --
> 2.50.1
>
This likely would trigger an unused variable (cpu_flags) warning, I've
changed locally to put the whole body in #if.
--- a/libavcodec/x86/fdctdsp_init.c
+++ b/libavcodec/x86/fdctdsp_init.c
@@ -26,6 +26,7 @@
av_cold void ff_fdctdsp_init_x86(FDCTDSPContext *c, AVCodecContext *avctx,
unsigned high_bit_depth)
{
+#if HAVE_SSE2_INLINE
int cpu_flags = av_get_cpu_flags();
const int dct_algo = avctx->dct_algo;
@@ -35,4 +36,5 @@ av_cold void ff_fdctdsp_init_x86(FDCTDSPContext *c,
AVCodecContext *avctx,
c->fdct = ff_fdct_sse2;
}
}
+#endif
}
- Kacper
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 11+ messages in thread
* [FFmpeg-devel] [PATCH 09/10] avcodec/x86/vc1: guard usage of undefined functions with preprocessor
2025-07-22 19:16 [FFmpeg-devel] [PATCH 01/10] avformat/os_support: check invalid socket value correctly on Windows Kacper Michajłow
` (6 preceding siblings ...)
2025-07-22 19:16 ` [FFmpeg-devel] [PATCH 08/10] avcodec/x86/fdct: guard usage of undefined functions with preprocessor Kacper Michajłow
@ 2025-07-22 19:16 ` Kacper Michajłow
2025-07-22 19:16 ` [FFmpeg-devel] [PATCH 10/10] avformat/rtmpproto: " Kacper Michajłow
8 siblings, 0 replies; 11+ messages in thread
From: Kacper Michajłow @ 2025-07-22 19:16 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Kacper Michajłow
The asumption is that DCE will remove references to those functions.
However some compilers with certain instrumentation enabled doesn't DCE
those at all, resulting in linking failure. Tested with cl.exe -RTCu -RTCs.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
libavcodec/x86/vc1dsp.h | 4 ++++
libavcodec/x86/vc1dsp_init.c | 2 ++
2 files changed, 6 insertions(+)
diff --git a/libavcodec/x86/vc1dsp.h b/libavcodec/x86/vc1dsp.h
index fdd4de1813..6185407b18 100644
--- a/libavcodec/x86/vc1dsp.h
+++ b/libavcodec/x86/vc1dsp.h
@@ -23,7 +23,11 @@
#include "libavcodec/vc1dsp.h"
+#if HAVE_6REGS && HAVE_INLINE_ASM && HAVE_MMX_EXTERNAL
+
void ff_vc1dsp_init_mmx(VC1DSPContext *dsp);
void ff_vc1dsp_init_mmxext(VC1DSPContext *dsp);
+#endif /* HAVE_6REGS && HAVE_INLINE_ASM && HAVE_MMX_EXTERNAL */
+
#endif /* AVCODEC_X86_VC1DSP_H */
diff --git a/libavcodec/x86/vc1dsp_init.c b/libavcodec/x86/vc1dsp_init.c
index 90b2f3624e..e8163f2886 100644
--- a/libavcodec/x86/vc1dsp_init.c
+++ b/libavcodec/x86/vc1dsp_init.c
@@ -102,6 +102,7 @@ av_cold void ff_vc1dsp_init_x86(VC1DSPContext *dsp)
{
int cpu_flags = av_get_cpu_flags();
+#if HAVE_6REGS && HAVE_INLINE_ASM && HAVE_MMX_EXTERNAL
if (HAVE_6REGS && INLINE_MMX(cpu_flags))
if (EXTERNAL_MMX(cpu_flags))
ff_vc1dsp_init_mmx(dsp);
@@ -109,6 +110,7 @@ av_cold void ff_vc1dsp_init_x86(VC1DSPContext *dsp)
if (HAVE_6REGS && INLINE_MMXEXT(cpu_flags))
if (EXTERNAL_MMXEXT(cpu_flags))
ff_vc1dsp_init_mmxext(dsp);
+#endif /* HAVE_6REGS && HAVE_INLINE_ASM && HAVE_MMX_EXTERNAL */
#define ASSIGN_LF4(EXT) \
dsp->vc1_v_loop_filter4 = ff_vc1_v_loop_filter4_ ## EXT; \
--
2.50.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 11+ messages in thread
* [FFmpeg-devel] [PATCH 10/10] avformat/rtmpproto: guard usage of undefined functions with preprocessor
2025-07-22 19:16 [FFmpeg-devel] [PATCH 01/10] avformat/os_support: check invalid socket value correctly on Windows Kacper Michajłow
` (7 preceding siblings ...)
2025-07-22 19:16 ` [FFmpeg-devel] [PATCH 09/10] avcodec/x86/vc1: " Kacper Michajłow
@ 2025-07-22 19:16 ` Kacper Michajłow
8 siblings, 0 replies; 11+ messages in thread
From: Kacper Michajłow @ 2025-07-22 19:16 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Kacper Michajłow
The asumption is that DCE will remove references to those functions.
However some compilers with certain instrumentation enabled doesn't DCE
those at all, resulting in linking failure. Tested with cl.exe -RTCu -RTCs.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
libavformat/rtmpproto.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index dd850f72ed..a22db265fc 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -1265,7 +1265,8 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
for (i = 9; i <= RTMP_HANDSHAKE_PACKET_SIZE; i++)
tosend[i] = av_lfg_get(&rnd) >> 24;
- if (CONFIG_FFRTMPCRYPT_PROTOCOL && rt->encrypted) {
+#if CONFIG_FFRTMPCRYPT_PROTOCOL
+ if (rt->encrypted) {
/* When the client wants to use RTMPE, we have to change the command
* byte to 0x06 which means to use encrypted data and we have to set
* the flash version to at least 9.0.115.0. */
@@ -1280,6 +1281,7 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
if ((ret = ff_rtmpe_gen_pub_key(rt->stream, tosend + 1)) < 0)
return ret;
}
+#endif
client_pos = rtmp_handshake_imprint_with_digest(tosend + 1, rt->encrypted);
if (client_pos < 0)
@@ -1343,7 +1345,8 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
if (ret < 0)
return ret;
- if (CONFIG_FFRTMPCRYPT_PROTOCOL && rt->encrypted) {
+#if CONFIG_FFRTMPCRYPT_PROTOCOL
+ if (rt->encrypted) {
/* Compute the shared secret key sent by the server and initialize
* the RC4 encryption. */
if ((ret = ff_rtmpe_compute_secret_key(rt->stream, serverdata + 1,
@@ -1353,6 +1356,7 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
/* Encrypt the signature received by the server. */
ff_rtmpe_encrypt_sig(rt->stream, signature, digest, serverdata[0]);
}
+#endif
if (memcmp(signature, clientdata + RTMP_HANDSHAKE_PACKET_SIZE - 32, 32)) {
av_log(s, AV_LOG_ERROR, "Signature mismatch\n");
@@ -1373,25 +1377,30 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
if (ret < 0)
return ret;
- if (CONFIG_FFRTMPCRYPT_PROTOCOL && rt->encrypted) {
+#if CONFIG_FFRTMPCRYPT_PROTOCOL
+ if (rt->encrypted) {
/* Encrypt the signature to be send to the server. */
ff_rtmpe_encrypt_sig(rt->stream, tosend +
RTMP_HANDSHAKE_PACKET_SIZE - 32, digest,
serverdata[0]);
}
+#endif
// write reply back to the server
if ((ret = ffurl_write(rt->stream, tosend,
RTMP_HANDSHAKE_PACKET_SIZE)) < 0)
return ret;
- if (CONFIG_FFRTMPCRYPT_PROTOCOL && rt->encrypted) {
+#if CONFIG_FFRTMPCRYPT_PROTOCOL
+ if (rt->encrypted) {
/* Set RC4 keys for encryption and update the keystreams. */
if ((ret = ff_rtmpe_update_keystream(rt->stream)) < 0)
return ret;
}
+#endif
} else {
- if (CONFIG_FFRTMPCRYPT_PROTOCOL && rt->encrypted) {
+#if CONFIG_FFRTMPCRYPT_PROTOCOL
+ if (rt->encrypted) {
/* Compute the shared secret key sent by the server and initialize
* the RC4 encryption. */
if ((ret = ff_rtmpe_compute_secret_key(rt->stream, serverdata + 1,
@@ -1404,16 +1413,19 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
serverdata[0]);
}
}
+#endif
if ((ret = ffurl_write(rt->stream, serverdata + 1,
RTMP_HANDSHAKE_PACKET_SIZE)) < 0)
return ret;
- if (CONFIG_FFRTMPCRYPT_PROTOCOL && rt->encrypted) {
+#if CONFIG_FFRTMPCRYPT_PROTOCOL
+ if (rt->encrypted) {
/* Set RC4 keys for encryption and update the keystreams. */
if ((ret = ff_rtmpe_update_keystream(rt->stream)) < 0)
return ret;
}
+#endif
}
return 0;
--
2.50.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 11+ messages in thread