[FFmpeg-cvslog] avformat/ffmdec: Only return EAGAIN if a server is attached
Michael Niedermayer
git at videolan.org
Fri Nov 20 20:28:53 CET 2015
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Fri Nov 20 03:10:11 2015 +0100| [9b7d39de81cebb689404cd362ed365aa6d451050] | committer: Michael Niedermayer
avformat/ffmdec: Only return EAGAIN if a server is attached
This should fix a infinite loop
Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun at googlemail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9b7d39de81cebb689404cd362ed365aa6d451050
---
libavformat/ffmdec.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index c3850db..e7c1449 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -49,7 +49,10 @@ static int ffm_is_avail_data(AVFormatContext *s, int size)
} else {
if (pos == ffm->write_index) {
/* exactly at the end of stream */
- return AVERROR(EAGAIN);
+ if (ffm->server_attached)
+ return AVERROR(EAGAIN);
+ else
+ return AVERROR_INVALIDDATA;
} else if (pos < ffm->write_index) {
avail_size = ffm->write_index - pos;
} else {
@@ -59,8 +62,10 @@ static int ffm_is_avail_data(AVFormatContext *s, int size)
avail_size = (avail_size / ffm->packet_size) * (ffm->packet_size - FFM_HEADER_SIZE) + len;
if (size <= avail_size)
return 1;
- else
+ else if (ffm->server_attached)
return AVERROR(EAGAIN);
+ else
+ return AVERROR_INVALIDDATA;
}
static int ffm_resync(AVFormatContext *s, int state)
More information about the ffmpeg-cvslog
mailing list