diff --git a/.gitignore b/.gitignore index c7078cb..3c27f6a 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ device/mpp/sample/venc/su.WK3 device/mpp/sample/venc/su.PS device/mpp/sample/venc/su.PRI device/mpp/sample/venc/su.PR +device/mpp/sample/venc/Makefile2 diff --git a/device/mpp/sample/common/sample_comm_venc.c b/device/mpp/sample/common/sample_comm_venc.c index c7175ad..d2661af 100644 --- a/device/mpp/sample/common/sample_comm_venc.c +++ b/device/mpp/sample/common/sample_comm_venc.c @@ -332,29 +332,25 @@ HI_S32 SAMPLE_COMM_VENC_SaveH264(FILE* fpH264File, VENC_STREAM_S *pstStream) printf("islice "); if(pstStream->pstPack[i].DataType.enH264EType == H264E_NALU_SEI) { printf("sei "); -// break; // ignore sei frame } if(pstStream->pstPack[i].DataType.enH264EType == H264E_NALU_SPS) printf("sps "); if(pstStream->pstPack[i].DataType.enH264EType == H264E_NALU_IPSLICE) printf("islice "); - /* + fwrite(pstStream->pstPack[i].pu8Addr + pstStream->pstPack[i].u32Offset , - pstStream->pstPack[i].u32Len - pstStream->pstPack[i].u32Offset, 1, fpH264File);*/ + pstStream->pstPack[i].u32Len - pstStream->pstPack[i].u32Offset, 1, fpH264File); unsigned char *p = pstStream->pstPack[i].pu8Addr; printf("h264 header file %d length %d nal count %d offset %x %x %x %x %x %x %x %x\r\n", pstStream->pstPack[i].u32Len - pstStream->pstPack[i].u32Offset, i, pstStream->pstPack[i].u32Offset, p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7]); - int packCnt = Pack264AndSend( - pstStream->pstPack[i].pu8Addr - ,pstStream->pstPack[i].u32Len + pstStream->pstPack[i].pu8Addr + pstStream->pstPack[i].u32Offset + ,pstStream->pstPack[i].u32Len - pstStream->pstPack[i].u32Offset , gRtspclient); - - - fflush(fpH264File); + fflush(fpH264File); } return HI_SUCCESS; } @@ -533,20 +529,21 @@ HI_S32 SAMPLE_COMM_VENC_Start(VENC_CHN VencChn, PAYLOAD_TYPE_E enType, if(SAMPLE_RC_CBR == enRcMode) { stVencChnAttr.stRcAttr.enRcMode = VENC_RC_MODE_H264CBR; - stH264Cbr.u32Gop = (VIDEO_ENCODING_MODE_PAL== enNorm)?25:25; + stH264Cbr.u32Gop = (VIDEO_ENCODING_MODE_PAL== enNorm)?3:3; stH264Cbr.u32StatTime = 1; /* stream rate statics time(s) */ - stH264Cbr.u32SrcFrmRate = (VIDEO_ENCODING_MODE_PAL== enNorm)?25:25;/* input (vi) frame rate */ - stH264Cbr.fr32DstFrmRate = (VIDEO_ENCODING_MODE_PAL== enNorm)?25:25;/* target frame rate */ + stH264Cbr.u32SrcFrmRate = (VIDEO_ENCODING_MODE_PAL== enNorm)?3:3;/* input (vi) frame rate */ + stH264Cbr.fr32DstFrmRate = (VIDEO_ENCODING_MODE_PAL== enNorm)?3:3;/* target frame rate */ switch (enSize) { case PIC_QCIF: - stH264Cbr.u32BitRate = 256; /* average bit rate */ + stH264Cbr.u32BitRate = 80; /* average bit rate */ break; case PIC_QVGA: /* 320 * 240 */ + stH264Cbr.u32BitRate = 80; case PIC_CIF: - stH264Cbr.u32BitRate = 512; + stH264Cbr.u32BitRate = 80; break; case PIC_D1: @@ -1299,7 +1296,7 @@ HI_VOID* SAMPLE_COMM_VENC_GetVencStreamProc(HI_VOID *p) /******************************************************* step 2.5 : save frame to file *******************************************************/ - if( i == 1){ + if(i == 2){ s32Ret = SAMPLE_COMM_VENC_SaveStream(enPayLoadType[i], pFile[i], &stStream); if (HI_SUCCESS != s32Ret) { diff --git a/device/mpp/sample/venc/librtsp.c b/device/mpp/sample/venc/librtsp.c index c6668aa..3cfce7a 100644 --- a/device/mpp/sample/venc/librtsp.c +++ b/device/mpp/sample/venc/librtsp.c @@ -157,7 +157,7 @@ int SendRecord(RtspClient *p,CallBack *c){ int SendRtpPackage(RtspClient *p,unsigned char *buf,int length) { int ret = Send(p->sock,(char*)buf,length); - printf("request send %d ,send rtp pack %d \r\n",length,ret,buf); + //printf("request send %d ,send rtp pack %d \r\n",length,ret,buf); if(0 > ret){ CloseConn(p->sock); p->conn = FALSE; diff --git a/device/mpp/sample/venc/main b/device/mpp/sample/venc/main index 91d6e50..7941bc2 100644 Binary files a/device/mpp/sample/venc/main and b/device/mpp/sample/venc/main differ diff --git a/device/mpp/sample/venc/rtp.c b/device/mpp/sample/venc/rtp.c index 315f17b..d098ed6 100644 --- a/device/mpp/sample/venc/rtp.c +++ b/device/mpp/sample/venc/rtp.c @@ -155,7 +155,7 @@ int Pack264AndSend(unsigned char *frame,int size,RtspClient * p){ return -1; } int packCnt = (size - 5) /MAX_RTP_LEN; - printf("%d package pack\r\n",packCnt); +// printf("%d package pack\r\n",packCnt); if(packCnt == 0) { header.seq = htons(seq++); sendLength = size - 5 + sizeof(FuIdentifier) + sizeof(CRtpHeader) + sizeof(rtspInterleavedFrameHeader); @@ -193,7 +193,7 @@ int Pack264AndSend(unsigned char *frame,int size,RtspClient * p){ rtspInterleavedFrameHeader.length = htons(MAX_RTP_LEN + sizeof(CH264NalUnit) + sizeof(CRtpHeader)); }else{ sendLength = (size - 5)%MAX_RTP_LEN + sizeof(CH264NalUnit) + sizeof(CRtpHeader) + sizeof(RtspInterleavedFrameHeader); - printf("last package send %d length\r\n",sendLength); + //printf("last package send %d length\r\n",sendLength); rtspInterleavedFrameHeader.length = htons((size - 5)%MAX_RTP_LEN + sizeof(CH264NalUnit) + sizeof(CRtpHeader)); } nalUnit.Header.End = 1;