Opened 8 months ago

Closed 7 months ago

#8760 closed enhancement (fixed)

srt updated, ffmpeg's libsrt no longer builds

Reported by: hydra3333 Owned by:
Priority: wish Component: avformat
Version: git-master Keywords: libsrt
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
Upstream srt commit
https://github.com/Haivision/srt/commit/0e2201aff6b379979cec43fee5e8f162717f6346
causes ffmpeg's libsrt to no longer build.

An issue there
https://github.com/Haivision/srt/issues/1382#issuecomment-650241468
says ffmpeg needs to be updated.

ffmpeg (static) build Log:

How to reproduce:
try to build ffmpeg with srt as a dependency when srt has been built from their latest git master.

CC	libavformat/librtmp.o
CC	libavformat/libsrt.o
libavformat/libopenmpt.c: In function 'read_probe_openmpt':
libavformat/libopenmpt.c:251:41: warning: passing argument 1 of 'probe_openmpt_extension' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  251 |             if (probe_openmpt_extension(p) > 0) {
      |                                         ^
libavformat/libopenmpt.c:221:49: note: expected 'AVProbeData *' but argument is of type 'const AVProbeData *'
  221 | static int probe_openmpt_extension(AVProbeData *p)
      |                                    ~~~~~~~~~~~~~^
libavformat/libopenmpt.c:274:36: warning: passing argument 1 of 'probe_openmpt_extension' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  274 |     return probe_openmpt_extension(p);
      |                                    ^
libavformat/libopenmpt.c:221:49: note: expected 'AVProbeData *' but argument is of type 'const AVProbeData *'
  221 | static int probe_openmpt_extension(AVProbeData *p)
      |                                    ~~~~~~~~~~~~~^
CC	libavformat/lmlm4.o
CC	libavformat/loasdec.o
CC	libavformat/lrc.o
CC	libavformat/lrcdec.o
libavformat/libsrt.c: In function 'libsrt_set_options_pre':
libavformat/libsrt.c:317:66: error: 'SRTO_STRICTENC' undeclared (first use in this function); did you mean 'SRTO_STATE'?
  317 |         (s->enforced_encryption >= 0 && libsrt_setsockopt(h, fd, SRTO_STRICTENC, "SRTO_STRICTENC", &s->enforced_encryption, sizeof(s->enforced_encryption)) < 0) ||
      |                                                                  ^~~~~~~~~~~~~~
      |                                                                  SRTO_STATE
libavformat/libsrt.c:317:66: note: each undeclared identifier is reported only once for each function it appears in
libavformat/libsrt.c:336:50: error: 'SRTO_SMOOTHER' undeclared (first use in this function); did you mean 'SRTO_SENDER'?
  336 |         (s->smoother && libsrt_setsockopt(h, fd, SRTO_SMOOTHER, "SRTO_SMOOTHER", s->smoother, strlen(s->smoother)) < 0) ||
      |                                                  ^~~~~~~~~~~~~
      |                                                  SRTO_SENDER
libavformat/libsrt.c: In function 'libsrt_setup':
libavformat/libsrt.c:409:5: warning: 'srt_socket' is deprecated [-Wdeprecated-declarations]
  409 |     fd = srt_socket(cur_ai->ai_family, cur_ai->ai_socktype, 0);
      |     ^~
In file included from libavformat/libsrt.c:24:
/home/u/Desktop/_working/workdir/toolchain/x86_64-w64-mingw32/include/srt/srt.h:735:41: note: declared here
  735 | SRT_ATR_DEPRECATED_PX SRT_API SRTSOCKET srt_socket(int, int, int) SRT_ATR_DEPRECATED;
      |                                         ^~~~~~~~~~
make: *** [ffbuild/common.mak:59: libavformat/libsrt.o] Error 1

Change History (10)

comment:1 Changed 8 months ago by hydra3333

building srt at the prior commit makes ffmpeg build OK.

comment:2 Changed 8 months ago by cehoyos

  • Keywords libsrt added
  • Priority changed from important to wish
  • Type changed from defect to enhancement

comment:3 Changed 8 months ago by hydra3333

thank you.

for clarity, the offending upstream srt commit says

[core] Removed deprecated features from SRT C API (#1364)
* Cleared difference in cmake file
* ATTICs decommissioned

which seems to indicate ffmpeg's libsrt is now out of date and tries to use "decommissioned" bits.

comment:4 Changed 8 months ago by hydra3333

Hello. I just noticed the srt author also said
(in https://github.com/Haivision/srt/issues/1382#issuecomment-650334043 )
about ffmpeg/libsrt using srt :-

Deprecated options are not forever, sorry. I was hoping I did my best also to issue clear warnings for them.

Last edited 8 months ago by hydra3333 (previous) (diff)

comment:5 Changed 8 months ago by mdsh

Is this all that's required?

diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index 4de575b..158f6b8 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -313,8 +313,7 @@
         (s->pbkeylen >= 0 && libsrt_setsockopt(h, fd, SRTO_PBKEYLEN, "SRTO_PBKEYLEN", &s->pbkeylen, sizeof(s->pbkeylen)) < 0) ||
         (s->passphrase && libsrt_setsockopt(h, fd, SRTO_PASSPHRASE, "SRTO_PASSPHRASE", s->passphrase, strlen(s->passphrase)) < 0) ||
 #if SRT_VERSION_VALUE >= 0x010302
-        /* SRTO_STRICTENC == SRTO_ENFORCEDENCRYPTION (53), but for compatibility, we used SRTO_STRICTENC */
-        (s->enforced_encryption >= 0 && libsrt_setsockopt(h, fd, SRTO_STRICTENC, "SRTO_STRICTENC", &s->enforced_encryption, sizeof(s->enforced_encryption)) < 0) ||
+        (s->enforced_encryption >= 0 && libsrt_setsockopt(h, fd, SRTO_ENFORCEDENCRYPTION, "SRTO_ENFORCEDENCRYPTION", &s->enforced_encryption, sizeof(s->enforced_encryption)) < 0) ||
         (s->kmrefreshrate >= 0 && libsrt_setsockopt(h, fd, SRTO_KMREFRESHRATE, "SRTO_KMREFRESHRATE", &s->kmrefreshrate, sizeof(s->kmrefreshrate)) < 0) ||
         (s->kmpreannounce >= 0 && libsrt_setsockopt(h, fd, SRTO_KMPREANNOUNCE, "SRTO_KMPREANNOUNCE", &s->kmpreannounce, sizeof(s->kmpreannounce)) < 0) ||
 #endif
@@ -333,7 +332,7 @@
         (s->lossmaxttl >= 0 && libsrt_setsockopt(h, fd, SRTO_LOSSMAXTTL, "SRTO_LOSSMAXTTL", &s->lossmaxttl, sizeof(s->lossmaxttl)) < 0) ||
         (s->minversion >= 0 && libsrt_setsockopt(h, fd, SRTO_MINVERSION, "SRTO_MINVERSION", &s->minversion, sizeof(s->minversion)) < 0) ||
         (s->streamid && libsrt_setsockopt(h, fd, SRTO_STREAMID, "SRTO_STREAMID", s->streamid, strlen(s->streamid)) < 0) ||
-        (s->smoother && libsrt_setsockopt(h, fd, SRTO_SMOOTHER, "SRTO_SMOOTHER", s->smoother, strlen(s->smoother)) < 0) ||
+        (s->smoother && libsrt_setsockopt(h, fd, SRTO_CONGESTION, "SRTO_CONGESTION", s->smoother, strlen(s->smoother)) < 0) ||
         (s->messageapi >= 0 && libsrt_setsockopt(h, fd, SRTO_MESSAGEAPI, "SRTO_MESSAGEAPI", &s->messageapi, sizeof(s->messageapi)) < 0) ||
         (s->payload_size >= 0 && libsrt_setsockopt(h, fd, SRTO_PAYLOADSIZE, "SRTO_PAYLOADSIZE", &s->payload_size, sizeof(s->payload_size)) < 0) ||
         ((h->flags & AVIO_FLAG_WRITE) && libsrt_setsockopt(h, fd, SRTO_SENDER, "SRTO_SENDER", &yes, sizeof(yes)) < 0)) {

comment:6 follow-up: Changed 8 months ago by hydra3333

Hello.
It's the same patch I see MABS is now using.
I'll give it a whirl to see if it builds. I suppose you have tried it ?

comment:7 Changed 8 months ago by hydra3333

Well, with this patch it does build for me.

comment:8 in reply to: ↑ 6 Changed 8 months ago by sturmen

Replying to hydra3333:

Hello.
It's the same patch I see MABS is now using.
I'll give it a whirl to see if it builds. I suppose you have tried it ?

I build through MABS and it's not applying this patch, and I also don't see where it would be. Are you talking about a dev branch?

and I think this may be breaking zeranoe's builds too.

comment:9 Changed 7 months ago by kevleyski

(is the above considered a fix, or build workaround?)

comment:10 Changed 7 months ago by mypopy

  • Resolution set to fixed
  • Status changed from new to closed

fix by 7c59e1b0f285cd7c7b35fcd71f49c5fd52cf9315, so closed the issue

Note: See TracTickets for help on using tickets.