diff options
-rw-r--r-- | ffmpeg.c | 5 | ||||
-rw-r--r-- | libavformat/flvdec.c | 7 | ||||
-rw-r--r-- | libavformat/utils.c | 15 |
3 files changed, 8 insertions, 19 deletions
@@ -2102,10 +2102,7 @@ static int av_encode(AVFormatContext **output_files, /* read a frame from it and output it in the fifo */ is = input_files[file_index]; - ret= av_read_frame(is, &pkt); - if(ret == AVERROR(EAGAIN) && strcmp(is->iformat->name, "ffm")) - continue; - if (ret < 0) { + if (av_read_frame(is, &pkt) < 0) { file_table[file_index].eof_reached = 1; if (opt_shortest) break; 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 */ |