From 3abb8bc887afd7c595669342978428fea22113ee Mon Sep 17 00:00:00 2001
From: Daniel Kucera <daniel.kucera@gmail.com>
Date: Tue, 23 May 2017 20:21:58 +0200
Subject: [PATCH] udp: ignore UDP packets without payload
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@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
|
b
|
static int udp_read(URLContext *h, uint8_t *buf, int size)
|
| 1039 | 1039 | av_fifo_generic_read(s->fifo, buf, avail, NULL); |
| 1040 | 1040 | av_fifo_drain(s->fifo, AV_RL32(tmp) - avail); |
| 1041 | 1041 | pthread_mutex_unlock(&s->mutex); |
| 1042 | | return avail; |
| | 1042 | if (avail > 0){ |
| | 1043 | return avail; |
| | 1044 | } else { |
| | 1045 | continue; |
| | 1046 | } |
| 1043 | 1047 | } else if(s->circular_buffer_error){ |
| 1044 | 1048 | int err = s->circular_buffer_error; |
| 1045 | 1049 | pthread_mutex_unlock(&s->mutex); |