You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
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>
This commit is contained in:
@@ -49,7 +49,10 @@ static int ffm_is_avail_data(AVFormatContext *s, int size)
|
|||||||
} else {
|
} else {
|
||||||
if (pos == ffm->write_index) {
|
if (pos == ffm->write_index) {
|
||||||
/* exactly at the end of stream */
|
/* 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) {
|
} else if (pos < ffm->write_index) {
|
||||||
avail_size = ffm->write_index - pos;
|
avail_size = ffm->write_index - pos;
|
||||||
} else {
|
} 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;
|
avail_size = (avail_size / ffm->packet_size) * (ffm->packet_size - FFM_HEADER_SIZE) + len;
|
||||||
if (size <= avail_size)
|
if (size <= avail_size)
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else if (ffm->server_attached)
|
||||||
return AVERROR(EAGAIN);
|
return AVERROR(EAGAIN);
|
||||||
|
else
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ffm_resync(AVFormatContext *s, int state)
|
static int ffm_resync(AVFormatContext *s, int state)
|
||||||
|
Reference in New Issue
Block a user