Use kcp as QoS module

This commit is contained in:
dijunkun
2023-08-30 17:44:22 +08:00
parent a4cd77dcb0
commit 3c1f7973d0
79 changed files with 14442 additions and 3150 deletions

View File

@@ -0,0 +1,36 @@
#ifndef _NV_ENCODER_H_
#define _NV_ENCODER_H_
#include "NvEncoderCuda.h"
class VideoEncoder {
public:
VideoEncoder();
~VideoEncoder();
int Init();
int Encode(const uint8_t* pData, int nSize);
virtual int OnEncodedImage(char* encoded_packets, size_t size);
void ForceIdr();
private:
int index_of_GPU = 0;
GUID codec_guid = NV_ENC_CODEC_H264_GUID;
GUID preset_guid = NV_ENC_PRESET_P2_GUID;
NV_ENC_TUNING_INFO tuning_info =
NV_ENC_TUNING_INFO::NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY;
int frame_width = 1280;
int frame_height = 720;
int keyFrameInterval_ = 3000;
int maxBitrate_ = 2000;
int max_payload_size_ = 3000;
NvEncoder* encoder_ = nullptr;
CUcontext cuda_context_ = nullptr;
std::vector<std::vector<uint8_t>> encoded_packets_;
unsigned char* encoded_image_ = nullptr;
FILE* file_ = nullptr;
unsigned char* nv12_data_ = nullptr;
unsigned int seq_ = 0;
};
#endif