[FFmpeg-devel] [PATCH] udp: ignore UDP packets without payload

Daniel Kučera daniel.kucera at gmail.com
Sun May 28 21:58:10 EEST 2017


2017-05-23 20:44 GMT+02:00 Daniel Kucera <daniel.kucera at gmail.com>:
> Time to time some devices send UDP packets without payload.
> ffmpeg previously exited on receiving such packet, this patch
> fixes this behaviour.
>
> Signed-off-by: Daniel Kucera <daniel.kucera at gmail.com>
> ---
>  libavformat/udp.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/udp.c b/libavformat/udp.c
> index 3835f989c4..28fa7b2354 100644
> --- a/libavformat/udp.c
> +++ b/libavformat/udp.c
> @@ -1039,7 +1039,11 @@ static int udp_read(URLContext *h, uint8_t *buf, int size)
>                  av_fifo_generic_read(s->fifo, buf, avail, NULL);
>                  av_fifo_drain(s->fifo, AV_RL32(tmp) - avail);
>                  pthread_mutex_unlock(&s->mutex);
> -                return avail;
> +                if (avail > 0){
> +                    return avail;
> +                } else {
> +                    continue;
> +                }
>              } else if(s->circular_buffer_error){
>                  int err = s->circular_buffer_error;
>                  pthread_mutex_unlock(&s->mutex);
> --
> 2.11.0
>

Can anyone please review my patch?

Thank you.


S pozdravom / Best regards
Daniel Kucera.


More information about the ffmpeg-devel mailing list