[FFmpeg-cvslog] h264: do not abuse the context as a temporary storage in get_last_needed_nal()

Anton Khirnov git at videolan.org
Sat Mar 21 17:09:49 CET 2015


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Tue Jan 27 14:25:01 2015 +0100| [2ea00e35e4e0b58f7a306dd55d8f72a21c32c946] | committer: Anton Khirnov

h264: do not abuse the context as a temporary storage in get_last_needed_nal()

Use a local variable instead.

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

 libavcodec/h264.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index a2e3e01..6b72807 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -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;
         }
     }



More information about the ffmpeg-cvslog mailing list