diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-08-03 16:39:46 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-08-03 16:50:26 +0400 |
commit | 71a5cd7dbc681ef22e994b92412a8c1a088a2841 (patch) | |
tree | d71d0509396d06d476fd09db24931e4dc3506ee6 /libavformat/flvdec.c | |
parent | a2232e696be35cd0f9eb3ed8037a02767d1a939e (diff) |
flvdec: perform duration search just once
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/flvdec.c')
-rw-r--r-- | libavformat/flvdec.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 5b81f395c9..fb356b801b 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -52,6 +52,7 @@ typedef struct { } validate_index[2]; int validate_next; int validate_count; + int searched_for_end; } FLVContext; static int flv_probe(AVProbeData *p) @@ -744,7 +745,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) } // if not streamed and no duration from metadata then seek to end to find the duration from the timestamps - if(s->pb->seekable && (!s->duration || s->duration==AV_NOPTS_VALUE)){ + if(s->pb->seekable && (!s->duration || s->duration==AV_NOPTS_VALUE) && !flv->searched_for_end){ int size; const int64_t pos= avio_tell(s->pb); const int64_t fsize= avio_size(s->pb); @@ -757,6 +758,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) s->duration = ts * (int64_t)AV_TIME_BASE / 1000; } avio_seek(s->pb, pos, SEEK_SET); + flv->searched_for_end = 1; } if(stream_type == FLV_STREAM_TYPE_AUDIO){ |