summaryrefslogtreecommitdiff
path: root/libavformat/rm.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-12-06 20:03:42 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-12-06 20:03:42 +0000
commit012cd15fc4af505c659f1852594d52cd029363c6 (patch)
tree237001dbe1d4a4b8afe52cd94aed95ff8977540c /libavformat/rm.c
parenta8b81ec199c047c7534eafb22cdfdcfdf650f319 (diff)
downloadffmpeg-012cd15fc4af505c659f1852594d52cd029363c6.tar.gz
try to recover from errors instead of failing fataly
Originally committed as revision 3735 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/rm.c')
-rw-r--r--libavformat/rm.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/libavformat/rm.c b/libavformat/rm.c
index 462b0bd7f5..45cc170cd6 100644
--- a/libavformat/rm.c
+++ b/libavformat/rm.c
@@ -744,18 +744,21 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
st = s->streams[0];
} else {
redo:
- if(rm->remaining_len){
+ if (url_feof(pb))
+ return AVERROR_IO;
+ if(rm->remaining_len > 0){
num= rm->current_stream;
len= rm->remaining_len;
timestamp = AV_NOPTS_VALUE;
flags= 0;
}else{
- if (rm->nb_packets == 0)
- return AVERROR_IO;
- get_be16(pb);
+ if(get_byte(pb))
+ goto redo;
+ if(get_byte(pb))
+ goto redo;
len = get_be16(pb);
if (len < 12)
- return AVERROR_IO;
+ goto redo;
num = get_be16(pb);
timestamp = get_be32(pb);
res= get_byte(pb); /* reserved */
@@ -763,7 +766,6 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
// av_log(s, AV_LOG_DEBUG, "%d %d %X %d\n", num, timestamp, flags, res);
- rm->nb_packets--;
len -= 12;
}