Browse Source

avformat/ffmdec: Only return EAGAIN if a server is attached

This should fix a infinite loop

Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n3.0
Michael Niedermayer 10 years ago
parent
commit
9b7d39de81
1 changed files with 7 additions and 2 deletions
  1. +7
    -2
      libavformat/ffmdec.c

+ 7
- 2
libavformat/ffmdec.c View File

@@ -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)


Loading…
Cancel
Save