From 07679e680c01a6a96b66ed885cc4c8ddd906b124 Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier Date: Mon, 2 Mar 2009 20:32:24 +0000 Subject: revert r16717, r16718, r16719, EAGAIN handling, this causes FFserver to hang Originally committed as revision 17737 to svn://svn.ffmpeg.org/ffmpeg/branches/0.5 --- libavformat/flvdec.c | 7 ++++--- libavformat/utils.c | 15 +++------------ 2 files changed, 7 insertions(+), 15 deletions(-) (limited to 'libavformat') diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index c925e54539..9bc2517b15 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -313,6 +313,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) int64_t dts, pts = AV_NOPTS_VALUE; AVStream *st = NULL; + retry: for(;;){ pos = url_ftell(s->pb); url_fskip(s->pb, 4); /* size of previous packet */ @@ -348,7 +349,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) av_log(s, AV_LOG_ERROR, "skipping flv packet: type %d, size %d, flags %d\n", type, size, flags); skip: url_fseek(s->pb, next, SEEK_SET); - return AVERROR(EAGAIN); + continue; } /* skip empty data packets */ @@ -372,7 +373,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) || st->discard >= AVDISCARD_ALL ){ url_fseek(s->pb, next, SEEK_SET); - return AVERROR(EAGAIN); + continue; } if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY) av_add_index_entry(st, pos, dts, size, 0, AVINDEX_KEYFRAME); @@ -435,7 +436,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) st->codec->channels, st->codec->sample_rate); } - return AVERROR(EAGAIN); + goto retry; } } diff --git a/libavformat/utils.c b/libavformat/utils.c index 900bd206e1..0ffe96a00b 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1515,10 +1515,7 @@ static int av_seek_frame_generic(AVFormatContext *s, return ret; } for(i=0;; i++) { - int ret; - do{ - ret = av_read_frame(s, &pkt); - }while(ret == AVERROR(EAGAIN)); + int ret = av_read_frame(s, &pkt); if(ret<0) break; av_free_packet(&pkt); @@ -1741,9 +1738,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset if (i == ic->nb_streams) break; - do{ - ret = av_read_packet(ic, pkt); - }while(ret == AVERROR(EAGAIN)); + ret = av_read_packet(ic, pkt); if (ret != 0) break; read_size += pkt->size; @@ -1768,9 +1763,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset if (read_size >= DURATION_MAX_READ_SIZE) break; - do{ - ret = av_read_packet(ic, pkt); - }while(ret == AVERROR(EAGAIN)); + ret = av_read_packet(ic, pkt); if (ret != 0) break; read_size += pkt->size; @@ -2079,8 +2072,6 @@ int av_find_stream_info(AVFormatContext *ic) /* NOTE: a new stream can be added there if no header in file (AVFMTCTX_NOHEADER) */ ret = av_read_frame_internal(ic, &pkt1); - if(ret == AVERROR(EAGAIN)) - continue; if (ret < 0) { /* EOF or error */ ret = -1; /* we could not have all the codec parameters before EOF */ -- cgit v1.2.3