Merge commit '2ea00e35e4e0b58f7a306dd55d8f72a21c32c946'
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 21 Mar 2015 16:02:23 +0000 (17:02 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 21 Mar 2015 16:02:23 +0000 (17:02 +0100)
* commit '2ea00e35e4e0b58f7a306dd55d8f72a21c32c946':
  h264: do not abuse the context as a temporary storage in get_last_needed_nal()

Conflicts:
libavcodec/h264.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/h264.c

@@@ -1374,9 -1370,9 +1374,10 @@@ static int get_last_needed_nal(H264Cont
      int nal_index   = 0;
      int buf_index   = 0;
      int nals_needed = 0;
 +    int first_slice = 0;
  
      while(1) {
+         GetBitContext gb;
          int nalsize = 0;
          int dst_length, bit_length, consumed;
          const uint8_t *ptr;
          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))
++            if (!get_ue_golomb(&gb) ||
 +                !first_slice ||
 +                first_slice != h->nal_unit_type)
                  nals_needed = nal_index;
 +            if (!first_slice)
 +                first_slice = h->nal_unit_type;
          }
      }