houxiao
2016-12-29 633e76c1d533c3d9c257b92df7ebdfd36c9fd8a0
RtspFace/PL_H264Encoder.cpp
@@ -105,13 +105,13 @@
    in->pAVCodecContext->height = 600;//#todo from config
    in->pAVCodecContext->time_base.num=1;
    in->pAVCodecContext->time_base.den=25;
    in->pAVCodecContext->gop_size = 2;
    in->pAVCodecContext->gop_size = 25;
    in->pAVCodecContext->max_b_frames = 0;
   //in->pAVCodecContext->profile = FF_PROFILE_H264_MAIN;
    in->pAVCodecContext->pix_fmt = AV_PIX_FMT_YUV420P;
   
   av_opt_set(in->pAVCodecContext->priv_data, "preset", "superfast", 0);  
   //av_opt_set(c->priv_data, "tune", "zerolatency", 0);
   //av_opt_set(in->pAVCodecContext->priv_data, "tune", "zerolatency", 0);
   if(avcodec_open2(in->pAVCodecContext, avCodec, NULL) >= 0)
   {
@@ -323,6 +323,8 @@
      in->lastFrame.type = MB_Frame::MBFT_H264_NALU;
      in->lastFrame.buffer = in->buffer;
      in->lastFrame.buffSize = in->buffSize;
      in->lastFrame.width = frame->width;
      in->lastFrame.height = frame->height;
      in->lastFrame.pts = frame->pts;
   }
   
@@ -336,9 +338,8 @@
   if (!in->payError)
   {
      pm.type = PipeMaterial::PMT_FRAME;
      pm.buffer = (uint8_t*)(&(in->lastFrame));
      pm.buffSize = sizeof(in->lastFrame);
      pm.former = this;
      pm.buffer = &(in->lastFrame);
      pm.buffSize = 0;
   }
   pm.former = this;
   return !in->payError;