[FFmpeg-devel] [PATCH] libavformat/udp: add options send_pkt_size for udp over ip, for ts over ip, this value must be 1316(7*188)

Thomas Volkert silvo at gmx.net
Mon Apr 8 19:10:53 EEST 2019


Hi,


On 08.04.19 17:42, edward_email wrote:
> From: “Edward.Wu” <“edward_email at 126.com”>
>
> Signed-off-by: “Edward.Wu” <“edward_email at 126.com”>
> ---
>   libavformat/udp.c | 45 ++++++++++++++++++++++++++++++++++++++++++++-
>   1 file changed, 44 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/udp.c b/libavformat/udp.c
> index cf73d331e0..7563b671fe 100644
> --- a/libavformat/udp.c
> +++ b/libavformat/udp.c
> @@ -73,6 +73,7 @@
>   #define UDP_TX_BUF_SIZE 32768
>   #define UDP_MAX_PKT_SIZE 65536
>   #define UDP_HEADER_SIZE 8
> +#define UDP_PACKET_MAX 1472

Could you explain how you calculate this value and why it generally
valid in this case?


>
>   typedef struct UDPContext {
>       const AVClass *class;
> @@ -81,6 +82,9 @@ typedef struct UDPContext {
>       int udplite_coverage;
>       int buffer_size;
>       int pkt_size;
> +    int send_pkt_size;
> +    uint8_t send_pkt_buf[UDP_PACKET_MAX];
> +    int cur_send_pkt_len;
>       int is_multicast;
>       int is_broadcast;
>       int local_port;
> @@ -125,6 +129,7 @@ static const AVOption options[] = {
>       { "localaddr",      "Local address",                                   OFFSET(localaddr),      AV_OPT_TYPE_STRING, { .str = NULL },               .flags = D|E },
>       { "udplite_coverage", "choose UDPLite head size which should be validated by checksum", OFFSET(udplite_coverage), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, D|E },
>       { "pkt_size",       "Maximum UDP packet size",                         OFFSET(pkt_size),       AV_OPT_TYPE_INT,    { .i64 = 1472 },  -1, INT_MAX, .flags = D|E },
> +    { "send_pkt_size",   "Send UDP packet size, ts over ip must be 1316",  OFFSET(send_pkt_size),  AV_OPT_TYPE_INT,    { .i64 = 0 },  -1, 1472, .flags = D|E },

I assume ts means "MPEG-TS": why does it need to be 7 times an MPEG-TS
packet? Why not 6 times or less? What about jumbo packets which exceeds
the size of an 1500 MTU and are definitely possible under defined
circumstances?


Best regards,
Thomas.



More information about the ffmpeg-devel mailing list