On Mon, Feb 29, 2016 at 10:40:02PM +0300, Pavel Nikiforov wrote: > Hello ! > > This patch enables background sending of UDP packets with specified delay. > When sending packets without a delay some devices with small RX buffer > ( MAG200 STB, for example) will drop tail packets in burst causing > decoding errors. > > It needs to specify "fifo_size" with "packet_gap" . > > The output url will looks like udp://xxx:yyy?fifo_size=<output fifo > size>&packet_gap=<delay in usecs> > > Patch attached.
> udp.c | 133 > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 129 insertions(+), 4 deletions(-) > 80b57f176b5492070b2ed4853472de61b7d9ab7f udp.patch > libavformat/udp.c | 133 > ++++++++++++++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 129 insertions(+), 4 deletions(-) > > diff --git a/libavformat/udp.c b/libavformat/udp.c > index ea80e52..ff676f4 100644 > --- a/libavformat/udp.c > +++ b/libavformat/udp.c > @@ -92,6 +92,7 @@ typedef struct UDPContext { > int circular_buffer_size; > AVFifoBuffer *fifo; > int circular_buffer_error; > + int packet_gap; /* delay between transmitted packets */ > #if HAVE_PTHREAD_CANCEL > pthread_t circular_buffer_thread; > pthread_mutex_t mutex; > @@ -112,6 +113,7 @@ typedef struct UDPContext { > #define E AV_OPT_FLAG_ENCODING_PARAM > static const AVOption options[] = { > { "buffer_size", "System data size (in bytes)", > OFFSET(buffer_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, > .flags = D|E }, > + { "packet_gap", "Delay between packets, in usec", > OFFSET(packet_gap), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, > .flags = E }, units should be seconds so that SI suffixes like for usecs work also independant of this patch but supporting to transmit packets at at their PCR/SCR/transmit time should be interresting > { "localport", "Local port", > OFFSET(local_port), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, > D|E }, > { "local_port", "Local port", > OFFSET(local_port), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, > .flags = D|E }, > { "localaddr", "Local address", > OFFSET(localaddr), AV_OPT_TYPE_STRING, { .str = NULL }, > .flags = D|E }, > @@ -486,7 +488,7 @@ static int udp_get_file_handle(URLContext *h) > } > > #if HAVE_PTHREAD_CANCEL > -static void *circular_buffer_task( void *_URLContext) > +static void *circular_buffer_task_rx( void *_URLContext) > { > URLContext *h = _URLContext; > UDPContext *s = h->priv_data; renaming things should be in a seperate patch anyway, real review left to someone who knows th network stuff better like nicolas [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel