Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 1 | From aebb72e025cbfbd4a6765354f6f565ad4ac89789 Mon Sep 17 00:00:00 2001 |
| 2 | From: Jun Zhao <barryjzhao@tencent.com> |
| 3 | Date: Sun, 12 Jul 2020 05:48:48 +0800 |
| 4 | Subject: [PATCH] lavf/srt: fix build fail when used the libsrt 1.4.1 |
| 5 | |
| 6 | lavf/srt: fix build fail when used the libsrt 1.4.1 |
| 7 | |
| 8 | libsrt changed the: |
| 9 | SRTO_SMOOTHER -> SRTO_CONGESTION |
| 10 | SRTO_STRICTENC -> SRTO_ENFORCEDENCRYPTION |
| 11 | and removed the front of deprecated options (SRTO_SMOOTHER/SRTO_STRICTENC) |
| 12 | in the header, it's lead to build fail |
| 13 | |
| 14 | fix #8760 |
| 15 | |
| 16 | Upstream-Status: Backport [https://github.com/FFmpeg/FFmpeg/commit/7c59e1b0f285cd7c7b35fcd71f49c5fd52cf9315] |
| 17 | |
| 18 | Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com> |
| 19 | Signed-off-by: Jun Zhao <barryjzhao@tencent.com> |
| 20 | --- |
| 21 | libavformat/libsrt.c | 8 ++++++++ |
| 22 | 1 file changed, 8 insertions(+) |
| 23 | |
| 24 | diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c |
| 25 | index 4de575b..4719ce0 100644 |
| 26 | --- a/libavformat/libsrt.c |
| 27 | +++ b/libavformat/libsrt.c |
| 28 | @@ -313,8 +313,12 @@ static int libsrt_set_options_pre(URLContext *h, int fd) |
| 29 | (s->pbkeylen >= 0 && libsrt_setsockopt(h, fd, SRTO_PBKEYLEN, "SRTO_PBKEYLEN", &s->pbkeylen, sizeof(s->pbkeylen)) < 0) || |
| 30 | (s->passphrase && libsrt_setsockopt(h, fd, SRTO_PASSPHRASE, "SRTO_PASSPHRASE", s->passphrase, strlen(s->passphrase)) < 0) || |
| 31 | #if SRT_VERSION_VALUE >= 0x010302 |
| 32 | +#if SRT_VERSION_VALUE >= 0x010401 |
| 33 | + (s->enforced_encryption >= 0 && libsrt_setsockopt(h, fd, SRTO_ENFORCEDENCRYPTION, "SRTO_ENFORCEDENCRYPTION", &s->enforced_encryption, sizeof(s->enforced_encryption)) < 0) || |
| 34 | +#else |
| 35 | /* SRTO_STRICTENC == SRTO_ENFORCEDENCRYPTION (53), but for compatibility, we used SRTO_STRICTENC */ |
| 36 | (s->enforced_encryption >= 0 && libsrt_setsockopt(h, fd, SRTO_STRICTENC, "SRTO_STRICTENC", &s->enforced_encryption, sizeof(s->enforced_encryption)) < 0) || |
| 37 | +#endif |
| 38 | (s->kmrefreshrate >= 0 && libsrt_setsockopt(h, fd, SRTO_KMREFRESHRATE, "SRTO_KMREFRESHRATE", &s->kmrefreshrate, sizeof(s->kmrefreshrate)) < 0) || |
| 39 | (s->kmpreannounce >= 0 && libsrt_setsockopt(h, fd, SRTO_KMPREANNOUNCE, "SRTO_KMPREANNOUNCE", &s->kmpreannounce, sizeof(s->kmpreannounce)) < 0) || |
| 40 | #endif |
| 41 | @@ -333,7 +337,11 @@ static int libsrt_set_options_pre(URLContext *h, int fd) |
| 42 | (s->lossmaxttl >= 0 && libsrt_setsockopt(h, fd, SRTO_LOSSMAXTTL, "SRTO_LOSSMAXTTL", &s->lossmaxttl, sizeof(s->lossmaxttl)) < 0) || |
| 43 | (s->minversion >= 0 && libsrt_setsockopt(h, fd, SRTO_MINVERSION, "SRTO_MINVERSION", &s->minversion, sizeof(s->minversion)) < 0) || |
| 44 | (s->streamid && libsrt_setsockopt(h, fd, SRTO_STREAMID, "SRTO_STREAMID", s->streamid, strlen(s->streamid)) < 0) || |
| 45 | +#if SRT_VERSION_VALUE >= 0x010401 |
| 46 | + (s->smoother && libsrt_setsockopt(h, fd, SRTO_CONGESTION, "SRTO_CONGESTION", s->smoother, strlen(s->smoother)) < 0) || |
| 47 | +#else |
| 48 | (s->smoother && libsrt_setsockopt(h, fd, SRTO_SMOOTHER, "SRTO_SMOOTHER", s->smoother, strlen(s->smoother)) < 0) || |
| 49 | +#endif |
| 50 | (s->messageapi >= 0 && libsrt_setsockopt(h, fd, SRTO_MESSAGEAPI, "SRTO_MESSAGEAPI", &s->messageapi, sizeof(s->messageapi)) < 0) || |
| 51 | (s->payload_size >= 0 && libsrt_setsockopt(h, fd, SRTO_PAYLOADSIZE, "SRTO_PAYLOADSIZE", &s->payload_size, sizeof(s->payload_size)) < 0) || |
| 52 | ((h->flags & AVIO_FLAG_WRITE) && libsrt_setsockopt(h, fd, SRTO_SENDER, "SRTO_SENDER", &yes, sizeof(yes)) < 0)) { |