code: private void captureH264MetaData(ByteBuffer encodedData, MediaCodec.BufferInfo bufferInfo) {
          mH264MetaSize = bufferInfo.size;
          mH264Keyframe = ByteBuffer.allocateDirect(encodedData.capacity());
          byte[] videoConfig = new byte[bufferInfo.size];
          encodedData.get(videoConfig, bufferInfo.offset, bufferInfo.size);
          encodedData.position(bufferInfo.offset);
          encodedData.put(videoConfig, 0, bufferInfo.size);
          encodedData.position(bufferInfo.offset);
          mH264Keyframe.put(videoConfig, 0, bufferInfo.size);
      }
docs: Should only be called once, when the encoder produces
  an output buffer with the BUFFER_FLAG_CODEC_CONFIG flag.
  For H264 output, this indicates the Sequence Parameter Set
  and Picture Parameter Set are contained in the buffer.
  These NAL units are required before every keyframe to ensure
  playback is possible in a segmented stream.
  
  @param encodedData
  @param bufferInfo