metartc5_jz源码阅读-yang_push_h264_package_single_nalu2

//通过单一nalu的方式发送视频帧。
int32_t yang_push_h264_package_single_nalu2(YangRtcSession *session,
		YangPushH264Rtp *rtp, YangFrame *videoFrame) {
	int32_t err = Yang_Ok;

	//重置videoRawPacket
	yang_reset_rtpPacket(&rtp->videoRawPacket);

	//设置PayloadType为h264
	rtp->videoRawPacket.header.payload_type = YangH264PayloadType;

	//设置ssrc
	rtp->videoRawPacket.header.ssrc = rtp->videoSsrc;

	//设置帧类型为video
	rtp->videoRawPacket.frame_type = YangFrameTypeVideo;

	//设置sequence
	rtp->videoRawPacket.header.sequence = rtp->videoSeq++;

	//设置timestamp为视频帧的显示时间戳
	rtp->videoRawPacket.header.timestamp = videoFrame->pts;
	rtp->videoRawPacket.header.marker = true;

	//设置payloadType为raw类型。
	rtp->videoRawPacket.payload_type = YangRtspPacketPayloadTypeRaw;

	//设置payload为视频buf
	rtp->videoRawData.payload = rtp->videoBuf;

	//设置videoRawData的size为视频帧的size
	rtp->videoRawData.nb = videoFrame->nb;

	//将视频帧的payload数据拷贝到videoRawData中。
	memcpy(rtp->videoRawData.payload, videoFrame->payload,
			rtp->videoRawData.nb);

	//调用此方法发送视频帧到p2p对端。
	if ((err = yang_push_h264_encodeVideo(session, rtp, &rtp->videoRawPacket))
			!= Yang_Ok) {
		return yang_error_wrap(err, "encode packet");
	}
	return err;
}

你可能感兴趣的:(metartc5_jz源码阅读,c语言,音视频,实时音视频,p2p)