diff mbox

[FFmpeg-devel] avformat/libsrt: fix merge of payload_size option

Message ID 20180902235844.20243-1-cus@passwd.hu
State Accepted
Commit 23fe072e43c2650c2de0adcac3cdbd17ca335259
Headers show

Commit Message

Marton Balint Sept. 2, 2018, 11:58 p.m. UTC
Fixes a compile error and re-adds pkt_size as a url?option as well.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavformat/libsrt.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

James Almer Sept. 3, 2018, 12:01 a.m. UTC | #1
On 9/2/2018 8:58 PM, Marton Balint wrote:
> Fixes a compile error and re-adds pkt_size as a url?option as well.

Sorry about that. I made sure to keep the logic as you added it a few
days ago instead of adopting the one from libav, including keeping the
option name you added and the default of -1, but i failed to notice this.

Feel free to push.

> 
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>  libavformat/libsrt.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
> index 9795e279e8..fbfd6ace83 100644
> --- a/libavformat/libsrt.c
> +++ b/libavformat/libsrt.c
> @@ -309,8 +309,8 @@ static int libsrt_set_options_pre(URLContext *h, int fd)
>          (s->peerlatency >= 0 && libsrt_setsockopt(h, fd, SRTO_PEERLATENCY, "SRTO_PEERLATENCY", &peerlatency, sizeof(peerlatency)) < 0) ||
>          (s->tlpktdrop >= 0 && libsrt_setsockopt(h, fd, SRTO_TLPKTDROP, "SRTO_TLPKDROP", &s->tlpktdrop, sizeof(s->tlpktdrop)) < 0) ||
>          (s->nakreport >= 0 && libsrt_setsockopt(h, fd, SRTO_NAKREPORT, "SRTO_NAKREPORT", &s->nakreport, sizeof(s->nakreport)) < 0) ||
> -        (connect_timeout >= 0 && libsrt_setsockopt(h, fd, SRTO_CONNTIMEO, "SRTO_CONNTIMEO", &connect_timeout, sizeof(connect_timeout)) <0 )) ||
> -        (s->payload_size >= 0 && libsrt_setsockopt(h, fd, SRTO_PAYLOADSIZE, "SRTO_PAYLOADSIZE", &s->payload_size, sizeof(s->payload_size)) < 0) {
> +        (connect_timeout >= 0 && libsrt_setsockopt(h, fd, SRTO_CONNTIMEO, "SRTO_CONNTIMEO", &connect_timeout, sizeof(connect_timeout)) <0 ) ||
> +        (s->payload_size >= 0 && libsrt_setsockopt(h, fd, SRTO_PAYLOADSIZE, "SRTO_PAYLOADSIZE", &s->payload_size, sizeof(s->payload_size)) < 0)) {
>          return AVERROR(EIO);
>      }
>      return 0;
> @@ -507,7 +507,8 @@ static int libsrt_open(URLContext *h, const char *uri, int flags)
>          if (av_find_info_tag(buf, sizeof(buf), "connect_timeout", p)) {
>              s->connect_timeout = strtol(buf, NULL, 10);
>          }
> -        if (av_find_info_tag(buf, sizeof(buf), "payload_size", p)) {
> +        if (av_find_info_tag(buf, sizeof(buf), "payload_size", p) ||
> +            av_find_info_tag(buf, sizeof(buf), "pkt_size", p)) {
>              s->payload_size = strtol(buf, NULL, 10);
>          }
>          if (av_find_info_tag(buf, sizeof(buf), "mode", p)) {
>
Marton Balint Sept. 3, 2018, 7:58 a.m. UTC | #2
On Sun, 2 Sep 2018, James Almer wrote:

> On 9/2/2018 8:58 PM, Marton Balint wrote:
>> Fixes a compile error and re-adds pkt_size as a url?option as well.
>
> Sorry about that. I made sure to keep the logic as you added it a few
> days ago instead of adopting the one from libav, including keeping the
> option name you added and the default of -1, but i failed to notice this.

No problem.

>
> Feel free to push.

Thanks, pushed.

Regards,
Marton
diff mbox

Patch

diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index 9795e279e8..fbfd6ace83 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -309,8 +309,8 @@  static int libsrt_set_options_pre(URLContext *h, int fd)
         (s->peerlatency >= 0 && libsrt_setsockopt(h, fd, SRTO_PEERLATENCY, "SRTO_PEERLATENCY", &peerlatency, sizeof(peerlatency)) < 0) ||
         (s->tlpktdrop >= 0 && libsrt_setsockopt(h, fd, SRTO_TLPKTDROP, "SRTO_TLPKDROP", &s->tlpktdrop, sizeof(s->tlpktdrop)) < 0) ||
         (s->nakreport >= 0 && libsrt_setsockopt(h, fd, SRTO_NAKREPORT, "SRTO_NAKREPORT", &s->nakreport, sizeof(s->nakreport)) < 0) ||
-        (connect_timeout >= 0 && libsrt_setsockopt(h, fd, SRTO_CONNTIMEO, "SRTO_CONNTIMEO", &connect_timeout, sizeof(connect_timeout)) <0 )) ||
-        (s->payload_size >= 0 && libsrt_setsockopt(h, fd, SRTO_PAYLOADSIZE, "SRTO_PAYLOADSIZE", &s->payload_size, sizeof(s->payload_size)) < 0) {
+        (connect_timeout >= 0 && libsrt_setsockopt(h, fd, SRTO_CONNTIMEO, "SRTO_CONNTIMEO", &connect_timeout, sizeof(connect_timeout)) <0 ) ||
+        (s->payload_size >= 0 && libsrt_setsockopt(h, fd, SRTO_PAYLOADSIZE, "SRTO_PAYLOADSIZE", &s->payload_size, sizeof(s->payload_size)) < 0)) {
         return AVERROR(EIO);
     }
     return 0;
@@ -507,7 +507,8 @@  static int libsrt_open(URLContext *h, const char *uri, int flags)
         if (av_find_info_tag(buf, sizeof(buf), "connect_timeout", p)) {
             s->connect_timeout = strtol(buf, NULL, 10);
         }
-        if (av_find_info_tag(buf, sizeof(buf), "payload_size", p)) {
+        if (av_find_info_tag(buf, sizeof(buf), "payload_size", p) ||
+            av_find_info_tag(buf, sizeof(buf), "pkt_size", p)) {
             s->payload_size = strtol(buf, NULL, 10);
         }
         if (av_find_info_tag(buf, sizeof(buf), "mode", p)) {