mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
Fix unused variables warnning
This commit is contained in:
@@ -25,7 +25,7 @@ class AudioFrame {
|
||||
|
||||
public:
|
||||
const uint8_t *Buffer() { return buffer_; }
|
||||
const size_t Size() { return size_; }
|
||||
size_t Size() { return size_; }
|
||||
|
||||
uint8_t *GetBuffer() { return buffer_; }
|
||||
|
||||
|
||||
@@ -25,15 +25,15 @@ class VideoFrame {
|
||||
|
||||
public:
|
||||
const uint8_t *Buffer() { return buffer_; }
|
||||
const size_t Size() { return size_; }
|
||||
size_t Size() { return size_; }
|
||||
|
||||
uint8_t *GetBuffer() { return buffer_; }
|
||||
|
||||
private:
|
||||
size_t width_ = 0;
|
||||
size_t height_ = 0;
|
||||
uint8_t *buffer_ = nullptr;
|
||||
size_t size_ = 0;
|
||||
size_t width_ = 0;
|
||||
size_t height_ = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -29,8 +29,6 @@ int AudioEncoder::Init() {
|
||||
std::chrono::high_resolution_clock::now().time_since_epoch())
|
||||
.count());
|
||||
int err;
|
||||
int applications[3] = {OPUS_APPLICATION_AUDIO, OPUS_APPLICATION_VOIP,
|
||||
OPUS_APPLICATION_RESTRICTED_LOWDELAY};
|
||||
|
||||
opus_encoder_ = opus_encoder_create(sample_rate_, channel_num_,
|
||||
OPUS_APPLICATION_VOIP, &err);
|
||||
|
||||
@@ -125,10 +125,10 @@ int FfmpegVideoDecoder::Decode(
|
||||
}
|
||||
|
||||
if (on_receive_decoded_frame) {
|
||||
uint64_t start_ts = static_cast<uint64_t>(
|
||||
std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::high_resolution_clock::now().time_since_epoch())
|
||||
.count());
|
||||
// uint64_t start_ts = static_cast<uint64_t>(
|
||||
// std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
// std::chrono::high_resolution_clock::now().time_since_epoch())
|
||||
// .count());
|
||||
|
||||
if (1) {
|
||||
av_image_fill_arrays(frame_nv12_->data, frame_nv12_->linesize,
|
||||
@@ -144,10 +144,10 @@ int FfmpegVideoDecoder::Decode(
|
||||
frame_->data[1], frame_->width * frame_->height / 2);
|
||||
}
|
||||
|
||||
uint64_t now_ts = static_cast<uint64_t>(
|
||||
std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::high_resolution_clock::now().time_since_epoch())
|
||||
.count());
|
||||
// uint64_t now_ts = static_cast<uint64_t>(
|
||||
// std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
// std::chrono::high_resolution_clock::now().time_since_epoch())
|
||||
// .count());
|
||||
|
||||
// LOG_ERROR("cost {}", now_ts - start_ts);
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ int OpenH264Decoder::Init() {
|
||||
sDecParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
|
||||
sDecParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
|
||||
|
||||
int32_t iRet = openh264_decoder_->Initialize(&sDecParam);
|
||||
openh264_decoder_->Initialize(&sDecParam);
|
||||
|
||||
int trace_level = WELS_LOG_QUIET;
|
||||
openh264_decoder_->SetOption(DECODER_OPTION_TRACE_LEVEL, &trace_level);
|
||||
@@ -156,11 +156,10 @@ int OpenH264Decoder::Decode(
|
||||
// LOG_WARN("Receive key frame");
|
||||
}
|
||||
|
||||
SBufferInfo sDstBufInfo = {0};
|
||||
SBufferInfo sDstBufInfo;
|
||||
memset(&sDstBufInfo, 0, sizeof(SBufferInfo));
|
||||
|
||||
int iRet = openh264_decoder_->DecodeFrameNoDelay(data, size, yuv_data_,
|
||||
&sDstBufInfo);
|
||||
openh264_decoder_->DecodeFrameNoDelay(data, size, yuv_data_, &sDstBufInfo);
|
||||
|
||||
if (sDstBufInfo.iBufferStatus == 1) {
|
||||
if (on_receive_decoded_frame) {
|
||||
|
||||
@@ -206,7 +206,6 @@ int OpenH264Encoder::Encode(
|
||||
}
|
||||
}
|
||||
|
||||
const uint8_t start_code[4] = {0, 0, 0, 1};
|
||||
size_t frag = 0;
|
||||
int encoded_frame_size = 0;
|
||||
for (int layer = 0; layer < info.iLayerNum; ++layer) {
|
||||
|
||||
@@ -167,9 +167,10 @@ int PeerConnection::Init(PeerConnectionParams params,
|
||||
}
|
||||
|
||||
int PeerConnection::CreateVideoCodec(bool hardware_acceleration) {
|
||||
hardware_acceleration_ = hardware_acceleration;
|
||||
#ifdef __APPLE__
|
||||
if (hardware_acceleration) {
|
||||
hardware_acceleration = false;
|
||||
if (hardware_acceleration_) {
|
||||
hardware_acceleration_ = false;
|
||||
LOG_WARN(
|
||||
"MacOS not support hardware acceleration, use default software codec");
|
||||
}
|
||||
@@ -238,8 +239,7 @@ int PeerConnection::CreateAudioCodec() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int PeerConnection::Create(PeerConnectionParams params,
|
||||
const std::string &transmission_id,
|
||||
int PeerConnection::Create(const std::string &transmission_id,
|
||||
const std::string &password) {
|
||||
if (SignalStatus::SignalConnected != GetSignalStatus()) {
|
||||
LOG_ERROR("Signal not connected");
|
||||
@@ -263,8 +263,7 @@ int PeerConnection::Create(PeerConnectionParams params,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int PeerConnection::Join(PeerConnectionParams params,
|
||||
const std::string &transmission_id,
|
||||
int PeerConnection::Join(const std::string &transmission_id,
|
||||
const std::string &password) {
|
||||
if (SignalStatus::SignalConnected != GetSignalStatus()) {
|
||||
LOG_ERROR("Signal not connected");
|
||||
|
||||
@@ -40,11 +40,10 @@ class PeerConnection {
|
||||
public:
|
||||
int Init(PeerConnectionParams params, const std::string &user_id);
|
||||
|
||||
int Create(PeerConnectionParams params,
|
||||
const std::string &transmission_id = "",
|
||||
int Create(const std::string &transmission_id = "",
|
||||
const std::string &password = "");
|
||||
|
||||
int Join(PeerConnectionParams params, const std::string &transmission_id,
|
||||
int Join(const std::string &transmission_id,
|
||||
const std::string &password = "");
|
||||
|
||||
int Leave();
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
using nlohmann::json;
|
||||
|
||||
static PeerConnection *peer_connection;
|
||||
|
||||
PeerPtr *CreatePeer(const Params *params) {
|
||||
PeerPtr *peer_ptr = new PeerPtr;
|
||||
peer_ptr->peer_connection = new PeerConnection();
|
||||
@@ -46,8 +44,7 @@ int CreateConnection(PeerPtr *peer_ptr, const char *transmission_id,
|
||||
LOG_INFO("CreateConnection [{}] with password [{}]", transmission_id,
|
||||
password);
|
||||
|
||||
return peer_ptr->peer_connection->Create(peer_ptr->pc_params, transmission_id,
|
||||
password);
|
||||
return peer_ptr->peer_connection->Create(transmission_id, password);
|
||||
}
|
||||
|
||||
int JoinConnection(PeerPtr *peer_ptr, const char *transmission_id,
|
||||
@@ -57,8 +54,7 @@ int JoinConnection(PeerPtr *peer_ptr, const char *transmission_id,
|
||||
return -1;
|
||||
}
|
||||
|
||||
peer_ptr->peer_connection->Join(peer_ptr->pc_params, transmission_id,
|
||||
password);
|
||||
peer_ptr->peer_connection->Join(transmission_id, password);
|
||||
LOG_INFO("JoinConnection[{}] with password [{}]", transmission_id, password);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ void RtcpReceiverReport::SetReportBlock(
|
||||
}
|
||||
|
||||
const uint8_t *RtcpReceiverReport::Encode() {
|
||||
int pos = rtcp_header_.Encode(DEFAULT_RTCP_VERSION, 0, DEFAULT_RR_BLOCK_NUM,
|
||||
RTCP_TYPE::RR, DEFAULT_RR_SIZE, buffer_);
|
||||
rtcp_header_.Encode(DEFAULT_RTCP_VERSION, 0, DEFAULT_RR_BLOCK_NUM,
|
||||
RTCP_TYPE::RR, DEFAULT_RR_SIZE, buffer_);
|
||||
|
||||
return buffer_;
|
||||
}
|
||||
@@ -24,14 +24,16 @@ void RtpAudioReceiver::InsertRtpPacket(RtpPacket& rtp_packet) {
|
||||
RtcpReceiverReport rtcp_rr;
|
||||
RtcpReportBlock report;
|
||||
|
||||
auto duration = std::chrono::system_clock::now().time_since_epoch();
|
||||
auto seconds = std::chrono::duration_cast<std::chrono::seconds>(duration);
|
||||
uint32_t seconds_u32 = static_cast<uint32_t>(
|
||||
std::chrono::duration_cast<std::chrono::seconds>(duration).count());
|
||||
// auto duration = std::chrono::system_clock::now().time_since_epoch();
|
||||
// auto seconds =
|
||||
// std::chrono::duration_cast<std::chrono::seconds>(duration); uint32_t
|
||||
// seconds_u32 = static_cast<uint32_t>(
|
||||
// std::chrono::duration_cast<std::chrono::seconds>(duration).count());
|
||||
|
||||
uint32_t fraction_u32 = static_cast<uint32_t>(
|
||||
std::chrono::duration_cast<std::chrono::nanoseconds>(duration - seconds)
|
||||
.count());
|
||||
// uint32_t fraction_u32 = static_cast<uint32_t>(
|
||||
// std::chrono::duration_cast<std::chrono::nanoseconds>(duration -
|
||||
// seconds)
|
||||
// .count());
|
||||
|
||||
report.source_ssrc = 0x00;
|
||||
report.fraction_lost = 0;
|
||||
|
||||
@@ -36,8 +36,6 @@ int RtpAudioSender::SendRtpPacket(RtpPacket& rtp_packet) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ret = 0;
|
||||
|
||||
if (0 !=
|
||||
data_send_func_((const char*)rtp_packet.Buffer(), rtp_packet.Size())) {
|
||||
LOG_ERROR("Send rtp packet failed");
|
||||
|
||||
@@ -24,14 +24,16 @@ void RtpDataReceiver::InsertRtpPacket(RtpPacket& rtp_packet) {
|
||||
RtcpReceiverReport rtcp_rr;
|
||||
RtcpReportBlock report;
|
||||
|
||||
auto duration = std::chrono::system_clock::now().time_since_epoch();
|
||||
auto seconds = std::chrono::duration_cast<std::chrono::seconds>(duration);
|
||||
uint32_t seconds_u32 = static_cast<uint32_t>(
|
||||
std::chrono::duration_cast<std::chrono::seconds>(duration).count());
|
||||
// auto duration = std::chrono::system_clock::now().time_since_epoch();
|
||||
// auto seconds =
|
||||
// std::chrono::duration_cast<std::chrono::seconds>(duration); uint32_t
|
||||
// seconds_u32 = static_cast<uint32_t>(
|
||||
// std::chrono::duration_cast<std::chrono::seconds>(duration).count());
|
||||
|
||||
uint32_t fraction_u32 = static_cast<uint32_t>(
|
||||
std::chrono::duration_cast<std::chrono::nanoseconds>(duration - seconds)
|
||||
.count());
|
||||
// uint32_t fraction_u32 = static_cast<uint32_t>(
|
||||
// std::chrono::duration_cast<std::chrono::nanoseconds>(duration -
|
||||
// seconds)
|
||||
// .count());
|
||||
|
||||
report.source_ssrc = 0x00;
|
||||
report.fraction_lost = 0;
|
||||
|
||||
@@ -36,8 +36,6 @@ int RtpDataSender::SendRtpPacket(RtpPacket& rtp_packet) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ret = 0;
|
||||
|
||||
if (0 !=
|
||||
data_send_func_((const char*)rtp_packet.Buffer(), rtp_packet.Size())) {
|
||||
LOG_ERROR("Send rtp packet failed");
|
||||
|
||||
@@ -258,9 +258,9 @@ class RtpPacket {
|
||||
return extension_data_;
|
||||
}
|
||||
|
||||
const uint8_t FecSymbolId() { return fec_symbol_id_; }
|
||||
uint8_t FecSymbolId() { return fec_symbol_id_; }
|
||||
|
||||
const uint8_t FecSourceSymbolNum() { return fec_source_symbol_num_; }
|
||||
uint8_t FecSourceSymbolNum() { return fec_source_symbol_num_; }
|
||||
|
||||
// Payload
|
||||
const uint8_t *Payload() {
|
||||
|
||||
@@ -27,14 +27,14 @@ void RtpVideoReceiver::InsertRtpPacket(RtpPacket& rtp_packet) {
|
||||
RtcpReceiverReport rtcp_rr;
|
||||
RtcpReportBlock report;
|
||||
|
||||
auto duration = std::chrono::system_clock::now().time_since_epoch();
|
||||
auto seconds = std::chrono::duration_cast<std::chrono::seconds>(duration);
|
||||
uint32_t seconds_u32 = static_cast<uint32_t>(
|
||||
std::chrono::duration_cast<std::chrono::seconds>(duration).count());
|
||||
// auto duration = std::chrono::system_clock::now().time_since_epoch();
|
||||
// auto seconds = std::chrono::duration_cast<std::chrono::seconds>(duration);
|
||||
// uint32_t seconds_u32 = static_cast<uint32_t>(
|
||||
// std::chrono::duration_cast<std::chrono::seconds>(duration).count());
|
||||
|
||||
uint32_t fraction_u32 = static_cast<uint32_t>(
|
||||
std::chrono::duration_cast<std::chrono::nanoseconds>(duration - seconds)
|
||||
.count());
|
||||
// uint32_t fraction_u32 = static_cast<uint32_t>(
|
||||
// std::chrono::duration_cast<std::chrono::nanoseconds>(duration - seconds)
|
||||
// .count());
|
||||
|
||||
report.source_ssrc = 0x00;
|
||||
report.fraction_lost = 0;
|
||||
|
||||
@@ -36,8 +36,6 @@ int RtpVideoSender::SendRtpPacket(RtpPacket& rtp_packet) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ret = 0;
|
||||
|
||||
if (0 !=
|
||||
data_send_func_((const char*)rtp_packet.Buffer(), rtp_packet.Size())) {
|
||||
LOG_ERROR("Send rtp packet failed");
|
||||
|
||||
@@ -86,6 +86,19 @@ class IceTransmission {
|
||||
uint8_t CheckIsAudioPacket(const char *buffer, size_t size);
|
||||
uint8_t CheckIsDataPacket(const char *buffer, size_t size);
|
||||
|
||||
private:
|
||||
std::string local_sdp_;
|
||||
std::string remote_sdp_;
|
||||
std::string local_candidates_;
|
||||
std::string remote_candidates_;
|
||||
unsigned int connection_id_ = 0;
|
||||
bool offer_peer_;
|
||||
std::string transmission_id_;
|
||||
std::string user_id_;
|
||||
std::string remote_user_id_;
|
||||
std::string remote_ice_username_ = "";
|
||||
NiceComponentState state_ = NICE_COMPONENT_STATE_DISCONNECTED;
|
||||
|
||||
private:
|
||||
std::unique_ptr<IceAgent> ice_agent_ = nullptr;
|
||||
std::shared_ptr<WsTransmission> ice_ws_transport_ = nullptr;
|
||||
@@ -97,17 +110,6 @@ class IceTransmission {
|
||||
std::function<void(const char *, size_t, const char *, size_t)>
|
||||
on_receive_data_ = nullptr;
|
||||
std::function<void(std::string)> on_ice_status_change_ = nullptr;
|
||||
std::string local_sdp_;
|
||||
std::string remote_sdp_;
|
||||
std::string local_candidates_;
|
||||
std::string remote_candidates_;
|
||||
unsigned int connection_id_ = 0;
|
||||
std::string transmission_id_ = "";
|
||||
std::string user_id_ = "";
|
||||
std::string remote_user_id_ = "";
|
||||
bool offer_peer_ = true;
|
||||
std::string remote_ice_username_ = "";
|
||||
NiceComponentState state_ = NICE_COMPONENT_STATE_DISCONNECTED;
|
||||
|
||||
private:
|
||||
std::unique_ptr<RtpCodec> video_rtp_codec_ = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user