rtsp: add pkt_size option

Message ID 20190411040715.28129-1-tmatth@videolan.org
State Committed
Commit 1e56173515826aa4d680d3b216d80a3879ed1c68
Headers show
Series
  • rtsp: add pkt_size option
Related show

Commit Message

Tristan Matthews April 11, 2019, 4:07 a.m.
This allows users to specify an upper limit on the size of outgoing packets
when publishing via RTSP.

---
 libavformat/rtsp.c | 5 ++++-
 libavformat/rtsp.h | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Martin Storsjö April 11, 2019, 5:41 a.m. | #1
On Thu, 11 Apr 2019, Tristan Matthews wrote:

> This allows users to specify an upper limit on the size of outgoing packets
> when publishing via RTSP.
>
> ---
> libavformat/rtsp.c | 5 ++++-
> libavformat/rtsp.h | 1 +
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> index 8bf9d9e3c..12c4998c6 100644
> --- a/libavformat/rtsp.c
> +++ b/libavformat/rtsp.c
> @@ -74,7 +74,8 @@
> 
> #define COMMON_OPTS() \
>     { "reorder_queue_size", "Number of packets to buffer for handling of reordered packets", OFFSET(reordering_queue_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, DEC }, \
> -    { "buffer_size",        "Underlying protocol send/receive buffer size",                  OFFSET(buffer_size),           AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, DEC|ENC } \
> +    { "buffer_size",        "Underlying protocol send/receive buffer size",                  OFFSET(buffer_size),           AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, DEC|ENC }, \
> +    { "pkt_size",           "Underlying protocol send packet size",                          OFFSET(pkt_size),              AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, ENC } \
> 
> 
> const AVOption ff_rtsp_options[] = {
> @@ -118,6 +119,8 @@ static AVDictionary *map_to_opts(RTSPState *rt)
>
>     snprintf(buf, sizeof(buf), "%d", rt->buffer_size);
>     av_dict_set(&opts, "buffer_size", buf, 0);
> +    snprintf(buf, sizeof(buf), "%d", rt->pkt_size);
> +    av_dict_set(&opts, "pkt_size", buf, 0);
>
>     return opts;
> }
> diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
> index 9dfbc5367..c38b90432 100644
> --- a/libavformat/rtsp.h
> +++ b/libavformat/rtsp.h
> @@ -399,6 +399,7 @@ typedef struct RTSPState {
>
>     char default_lang[4];
>     int buffer_size;
> +    int pkt_size;
>
>     const URLProtocol **protocols;
> } RTSPState;
> -- 
> 2.17.1

LGTM

// Martin
Tristan Matthews April 15, 2019, 2:17 p.m. | #2
On Thu, Apr 11, 2019 at 1:41 AM Martin Storsjö <martin@martin.st> wrote:
>
> On Thu, 11 Apr 2019, Tristan Matthews wrote:
>
> > This allows users to specify an upper limit on the size of outgoing packets
> > when publishing via RTSP.
> >
> > ---
> > libavformat/rtsp.c | 5 ++++-
> > libavformat/rtsp.h | 1 +
> > 2 files changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> > index 8bf9d9e3c..12c4998c6 100644
> > --- a/libavformat/rtsp.c
> > +++ b/libavformat/rtsp.c
> > @@ -74,7 +74,8 @@
> >
> > #define COMMON_OPTS() \
> >     { "reorder_queue_size", "Number of packets to buffer for handling of reordered packets", OFFSET(reordering_queue_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, DEC }, \
> > -    { "buffer_size",        "Underlying protocol send/receive buffer size",                  OFFSET(buffer_size),           AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, DEC|ENC } \
> > +    { "buffer_size",        "Underlying protocol send/receive buffer size",                  OFFSET(buffer_size),           AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, DEC|ENC }, \
> > +    { "pkt_size",           "Underlying protocol send packet size",                          OFFSET(pkt_size),              AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, ENC } \
> >
> >
> > const AVOption ff_rtsp_options[] = {
> > @@ -118,6 +119,8 @@ static AVDictionary *map_to_opts(RTSPState *rt)
> >
> >     snprintf(buf, sizeof(buf), "%d", rt->buffer_size);
> >     av_dict_set(&opts, "buffer_size", buf, 0);
> > +    snprintf(buf, sizeof(buf), "%d", rt->pkt_size);
> > +    av_dict_set(&opts, "pkt_size", buf, 0);
> >
> >     return opts;
> > }
> > diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
> > index 9dfbc5367..c38b90432 100644
> > --- a/libavformat/rtsp.h
> > +++ b/libavformat/rtsp.h
> > @@ -399,6 +399,7 @@ typedef struct RTSPState {
> >
> >     char default_lang[4];
> >     int buffer_size;
> > +    int pkt_size;
> >
> >     const URLProtocol **protocols;
> > } RTSPState;
> > --
> > 2.17.1
>
> LGTM
>
> // Martin

This OK to merge?
Martin Storsjö April 15, 2019, 7:45 p.m. | #3
On Mon, 15 Apr 2019, Tristan Matthews wrote:

> On Thu, Apr 11, 2019 at 1:41 AM Martin Storsjö <martin@martin.st> wrote:
>>
>> On Thu, 11 Apr 2019, Tristan Matthews wrote:
>>
>>> This allows users to specify an upper limit on the size of outgoing packets
>>> when publishing via RTSP.
>>>
>>> ---
>>> libavformat/rtsp.c | 5 ++++-
>>> libavformat/rtsp.h | 1 +
>>> 2 files changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
>>> index 8bf9d9e3c..12c4998c6 100644
>>> --- a/libavformat/rtsp.c
>>> +++ b/libavformat/rtsp.c
>>> @@ -74,7 +74,8 @@
>>>
>>> #define COMMON_OPTS() \
>>>     { "reorder_queue_size", "Number of packets to buffer for handling of reordered packets", OFFSET(reordering_queue_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, DEC }, \
>>> -    { "buffer_size",        "Underlying protocol send/receive buffer size",                  OFFSET(buffer_size),           AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, DEC|ENC } \
>>> +    { "buffer_size",        "Underlying protocol send/receive buffer size",                  OFFSET(buffer_size),           AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, DEC|ENC }, \
>>> +    { "pkt_size",           "Underlying protocol send packet size",                          OFFSET(pkt_size),              AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, ENC } \
>>>
>>>
>>> const AVOption ff_rtsp_options[] = {
>>> @@ -118,6 +119,8 @@ static AVDictionary *map_to_opts(RTSPState *rt)
>>>
>>>     snprintf(buf, sizeof(buf), "%d", rt->buffer_size);
>>>     av_dict_set(&opts, "buffer_size", buf, 0);
>>> +    snprintf(buf, sizeof(buf), "%d", rt->pkt_size);
>>> +    av_dict_set(&opts, "pkt_size", buf, 0);
>>>
>>>     return opts;
>>> }
>>> diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
>>> index 9dfbc5367..c38b90432 100644
>>> --- a/libavformat/rtsp.h
>>> +++ b/libavformat/rtsp.h
>>> @@ -399,6 +399,7 @@ typedef struct RTSPState {
>>>
>>>     char default_lang[4];
>>>     int buffer_size;
>>> +    int pkt_size;
>>>
>>>     const URLProtocol **protocols;
>>> } RTSPState;
>>> --
>>> 2.17.1
>>
>> LGTM
>>
>> // Martin
>
> This OK to merge?

Pushed it for you now, thanks!

// Martin

Patch

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 8bf9d9e3c..12c4998c6 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -74,7 +74,8 @@ 
 
 #define COMMON_OPTS() \
     { "reorder_queue_size", "Number of packets to buffer for handling of reordered packets", OFFSET(reordering_queue_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, DEC }, \
-    { "buffer_size",        "Underlying protocol send/receive buffer size",                  OFFSET(buffer_size),           AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, DEC|ENC } \
+    { "buffer_size",        "Underlying protocol send/receive buffer size",                  OFFSET(buffer_size),           AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, DEC|ENC }, \
+    { "pkt_size",           "Underlying protocol send packet size",                          OFFSET(pkt_size),              AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, ENC } \
 
 
 const AVOption ff_rtsp_options[] = {
@@ -118,6 +119,8 @@  static AVDictionary *map_to_opts(RTSPState *rt)
 
     snprintf(buf, sizeof(buf), "%d", rt->buffer_size);
     av_dict_set(&opts, "buffer_size", buf, 0);
+    snprintf(buf, sizeof(buf), "%d", rt->pkt_size);
+    av_dict_set(&opts, "pkt_size", buf, 0);
 
     return opts;
 }
diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
index 9dfbc5367..c38b90432 100644
--- a/libavformat/rtsp.h
+++ b/libavformat/rtsp.h
@@ -399,6 +399,7 @@  typedef struct RTSPState {
 
     char default_lang[4];
     int buffer_size;
+    int pkt_size;
 
     const URLProtocol **protocols;
 } RTSPState;