[FFmpeg-cvslog] rtpdec_vp8: Don't parse fields that aren't used

Martin Storsjö git at videolan.org
Fri Nov 2 15:12:07 CET 2012


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Tue Oct  9 01:17:45 2012 +0300| [2b831a59d9ea82ef5d906a58b11c41f51029b16e] | committer: Martin Storsjö

rtpdec_vp8: Don't parse fields that aren't used

This avoids warnings about unused variables.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2b831a59d9ea82ef5d906a58b11c41f51029b16e
---

 libavformat/rtpdec_vp8.c |   25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)

diff --git a/libavformat/rtpdec_vp8.c b/libavformat/rtpdec_vp8.c
index 541a1bc..a364358 100644
--- a/libavformat/rtpdec_vp8.c
+++ b/libavformat/rtpdec_vp8.c
@@ -45,16 +45,14 @@ static int vp8_handle_packet(AVFormatContext *ctx,
                              int len, int flags)
 {
     int start_partition, end_packet;
-    int extended_bits, non_ref, part_id;
+    int extended_bits, part_id;
     int pictureid_present = 0, tl0picidx_present = 0, tid_present = 0,
         keyidx_present = 0;
-    int pictureid = -1, keyidx = -1;
 
     if (len < 1)
         return AVERROR_INVALIDDATA;
 
     extended_bits   = buf[0] & 0x80;
-    non_ref         = buf[0] & 0x20;
     start_partition = buf[0] & 0x10;
     part_id         = buf[0] & 0x0f;
     end_packet      = flags & RTP_FLAG_MARKER;
@@ -71,19 +69,12 @@ static int vp8_handle_packet(AVFormatContext *ctx,
         len--;
     }
     if (pictureid_present) {
+        int size;
         if (len < 1)
             return AVERROR_INVALIDDATA;
-        if (buf[0] & 0x80) {
-            if (len < 2)
-                return AVERROR_INVALIDDATA;
-            pictureid = AV_RB16(buf) & 0x7fff;
-            buf += 2;
-            len -= 2;
-        } else {
-            pictureid = buf[0] & 0x7f;
-            buf++;
-            len--;
-        }
+        size = buf[0] & 0x80 ? 2 : 1;
+        buf += size;
+        len -= size;
     }
     if (tl0picidx_present) {
         // Ignoring temporal level zero index
@@ -91,11 +82,7 @@ static int vp8_handle_packet(AVFormatContext *ctx,
         len--;
     }
     if (tid_present || keyidx_present) {
-        // Ignoring temporal layer index and layer sync bit
-        if (len < 1)
-            return AVERROR_INVALIDDATA;
-        if (keyidx_present)
-            keyidx = buf[0] & 0x1f;
+        // Ignoring temporal layer index, layer sync bit and keyframe index
         buf++;
         len--;
     }



More information about the ffmpeg-cvslog mailing list