Mercurial > libavformat.hg
changeset 5916:1fec9e2cd5c5 libavformat
Fix flvdec start-of-frame.
Patch by Howard Chu hyc highlandsun com
author | benoit |
---|---|
date | Thu, 01 Apr 2010 08:02:20 +0000 |
parents | 4cc7fc1878b4 |
children | 6cc73b15aa28 |
files | flvdec.c |
diffstat | 1 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/flvdec.c Wed Mar 31 19:03:03 2010 +0000 +++ b/flvdec.c Thu Apr 01 08:02:20 2010 +0000 @@ -270,6 +270,7 @@ offset = get_be32(s->pb); url_fseek(s->pb, offset, SEEK_SET); + url_fskip(s->pb, 4); s->start_time = 0; @@ -295,9 +296,8 @@ int64_t dts, pts = AV_NOPTS_VALUE; AVStream *st = NULL; - for(;;){ + for(;;url_fskip(s->pb, 4)){ /* pkt size is repeated at end. skip it */ pos = url_ftell(s->pb); - url_fskip(s->pb, 4); /* size of previous packet */ type = get_byte(s->pb); size = get_be24(s->pb); dts = get_be24(s->pb); @@ -417,13 +417,16 @@ st->codec->channels, st->codec->sample_rate); } - return AVERROR(EAGAIN); + ret = AVERROR(EAGAIN); + goto leave; } } /* skip empty data packets */ - if (!size) - return AVERROR(EAGAIN); + if (!size) { + ret = AVERROR(EAGAIN); + goto leave; + } ret= av_get_packet(s->pb, pkt, size); if (ret < 0) { @@ -439,6 +442,8 @@ if (is_audio || ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY)) pkt->flags |= AV_PKT_FLAG_KEY; +leave: + url_fskip(s->pb, 4); return ret; }