h264: do not abuse the context as a temporary storage in get_last_needed_nal()
authorAnton Khirnov <anton@khirnov.net>
Tue, 27 Jan 2015 13:25:01 +0000 (14:25 +0100)
committerAnton Khirnov <anton@khirnov.net>
Sat, 21 Mar 2015 10:27:14 +0000 (11:27 +0100)
Use a local variable instead.

libavcodec/h264.c

index a2e3e01..6b72807 100644 (file)
@@ -1372,6 +1372,7 @@ static int get_last_needed_nal(H264Context *h, const uint8_t *buf, int buf_size)
     int nals_needed = 0;
 
     while(1) {
+        GetBitContext gb;
         int nalsize = 0;
         int dst_length, bit_length, consumed;
         const uint8_t *ptr;
@@ -1411,8 +1412,8 @@ static int get_last_needed_nal(H264Context *h, const uint8_t *buf, int buf_size)
         case NAL_DPA:
         case NAL_IDR_SLICE:
         case NAL_SLICE:
-            init_get_bits(&h->gb, ptr, bit_length);
-            if (!get_ue_golomb(&h->gb))
+            init_get_bits(&gb, ptr, bit_length);
+            if (!get_ue_golomb(&gb))
                 nals_needed = nal_index;
         }
     }