[FFmpeg-devel] [PATCH] udp: ignore UDP packets without payload
Daniel Kucera
daniel.kucera at gmail.com
Tue May 23 21:44:02 EEST 2017
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
More information about the ffmpeg-devel
mailing list