Permalink
Browse files

Prevent overwriting of IDR NAL header bits by SPS/PPS NALs

  • Loading branch information...
MartinRi committed Nov 2, 2016
1 parent f46c9e1 commit d4de63f70bd53dd91f8f1ec74259265770f5ee19
Showing with 3 additions and 1 deletion.
  1. +3 −1 libvpcodec.cpp
@@ -129,6 +129,7 @@ int vl_video_encoder_encode(vl_codec_handle_t codec_handle, vl_frame_type_t fram
if (handle->mNumInputFrames >= 0)
{
AMVEncFrameIO videoInput;
bool prependSPSPPS = false;
memset(&videoInput, 0, sizeof(videoInput));
videoInput.height = handle->mEncParams.height;
videoInput.pitch = ((handle->mEncParams.width + 15) >> 4) << 4;
@@ -158,6 +159,7 @@ int vl_video_encoder_encode(vl_codec_handle_t codec_handle, vl_frame_type_t fram
{
outPtr = (uint8_t *) *out + handle->mSPSPPSDataSize;
dataLength = /*should be out size */in_size - handle->mSPSPPSDataSize;
prependSPSPPS = true;
}
else
{
@@ -174,7 +176,7 @@ int vl_video_encoder_encode(vl_codec_handle_t codec_handle, vl_frame_type_t fram
ret = AML_HWEncNAL(handle, (unsigned char *)outPtr, (unsigned int *)&dataLength, &type);
if (ret == AMVENC_PICTURE_READY)
{
if (type == AVC_NALTYPE_IDR)
if (type == AVC_NALTYPE_IDR && prependSPSPPS)
{
if (handle->mSPSPPSData)
{

0 comments on commit d4de63f

Please sign in to comment.