changeset 3797:5fc16ca7b356 libavformat

simplify size handling code
author bcoudurier
date Fri, 29 Aug 2008 22:03:18 +0000
parents bae4b42939cc
children 181ce3b7ca8b
files flvdec.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/flvdec.c	Fri Aug 29 20:04:28 2008 +0000
+++ b/flvdec.c	Fri Aug 29 22:03:18 2008 +0000
@@ -322,11 +322,13 @@
     if (type == FLV_TAG_TYPE_AUDIO) {
         is_audio=1;
         flags = get_byte(s->pb);
+        size--;
     } else if (type == FLV_TAG_TYPE_VIDEO) {
         is_audio=0;
         flags = get_byte(s->pb);
+        size--;
         if ((flags & 0xf0) == 0x50) { /* video info / command frame */
-            url_fskip(s->pb, size - 1);
+            url_fskip(s->pb, size);
             continue;
         }
     } else {
@@ -400,13 +402,13 @@
             get_be24(s->pb);
         }
         if (type == 0) {
-            if ((ret = flv_get_extradata(s, st, size - 1)) < 0)
+            if ((ret = flv_get_extradata(s, st, size)) < 0)
                 return ret;
             goto retry;
         }
     }
 
-    ret= av_get_packet(s->pb, pkt, size - 1);
+    ret= av_get_packet(s->pb, pkt, size);
     if (ret <= 0) {
         return AVERROR(EIO);
     }