mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 20:25:34 +08:00
Change class name RtpVideoSession to RtpCodec
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
#include "rtp_video_session.h"
|
#include "rtp_codec.h"
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
@@ -9,14 +9,14 @@
|
|||||||
#define FU_A 28
|
#define FU_A 28
|
||||||
#define FU_B 29
|
#define FU_B 29
|
||||||
|
|
||||||
RtpVideoSession ::RtpVideoSession(PAYLOAD_TYPE payload_type)
|
RtpCodec ::RtpCodec(PAYLOAD_TYPE payload_type)
|
||||||
: version_(RTP_VERSION),
|
: version_(RTP_VERSION),
|
||||||
has_padding_(false),
|
has_padding_(false),
|
||||||
has_extension_(false),
|
has_extension_(false),
|
||||||
payload_type_(payload_type),
|
payload_type_(payload_type),
|
||||||
sequence_number_(0) {}
|
sequence_number_(0) {}
|
||||||
|
|
||||||
RtpVideoSession ::~RtpVideoSession() {
|
RtpCodec ::~RtpCodec() {
|
||||||
if (extension_data_) {
|
if (extension_data_) {
|
||||||
delete extension_data_;
|
delete extension_data_;
|
||||||
extension_data_ = nullptr;
|
extension_data_ = nullptr;
|
||||||
@@ -28,8 +28,8 @@ RtpVideoSession ::~RtpVideoSession() {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void RtpVideoSession::Encode(uint8_t* buffer, size_t size,
|
void RtpCodec::Encode(uint8_t* buffer, size_t size,
|
||||||
std::vector<RtpPacket>& packets) {
|
std::vector<RtpPacket>& packets) {
|
||||||
// if (!rtp_packet_) {
|
// if (!rtp_packet_) {
|
||||||
// rtp_packet_ = new RtpPacket();
|
// rtp_packet_ = new RtpPacket();
|
||||||
// }
|
// }
|
||||||
@@ -118,7 +118,7 @@ void RtpVideoSession::Encode(uint8_t* buffer, size_t size,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t RtpVideoSession::Decode(RtpPacket& packet, uint8_t* payload) {
|
size_t RtpCodec::Decode(RtpPacket& packet, uint8_t* payload) {
|
||||||
// if ((packet.Buffer()[13] >> 6) & 0x01) {
|
// if ((packet.Buffer()[13] >> 6) & 0x01) {
|
||||||
// LOG_ERROR("End bit!!!!!!!!!!!!!!!");
|
// LOG_ERROR("End bit!!!!!!!!!!!!!!!");
|
||||||
// }
|
// }
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef _RTP_VIDEO_SESSION_H_
|
#ifndef _RTP_CODEC_H_
|
||||||
#define _RTP_VIDEO_SESSION_H_
|
#define _RTP_CODEC_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@@ -7,10 +7,10 @@
|
|||||||
|
|
||||||
#include "rtp_packet.h"
|
#include "rtp_packet.h"
|
||||||
|
|
||||||
class RtpVideoSession {
|
class RtpCodec {
|
||||||
public:
|
public:
|
||||||
RtpVideoSession(PAYLOAD_TYPE payload_type);
|
RtpCodec(PAYLOAD_TYPE payload_type);
|
||||||
~RtpVideoSession();
|
~RtpCodec();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Encode(uint8_t* buffer, size_t size, std::vector<RtpPacket>& packets);
|
void Encode(uint8_t* buffer, size_t size, std::vector<RtpPacket>& packets);
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
#include "ringbuffer.h"
|
#include "ringbuffer.h"
|
||||||
#include "rtp_video_session.h"
|
#include "rtp_codec.h"
|
||||||
#include "thread_base.h"
|
#include "thread_base.h"
|
||||||
|
|
||||||
class RtpVideoReceiver : public ThreadBase {
|
class RtpVideoReceiver : public ThreadBase {
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ IceTransmission::~IceTransmission() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int IceTransmission::InitIceTransmission(std::string &ip, int port) {
|
int IceTransmission::InitIceTransmission(std::string &ip, int port) {
|
||||||
rtp_video_session_ = std::make_unique<RtpVideoSession>(PAYLOAD_TYPE::H264);
|
rtp_codec_ = std::make_unique<RtpCodec>(PAYLOAD_TYPE::H264);
|
||||||
rtp_video_receiver_ = std::make_unique<RtpVideoReceiver>();
|
rtp_video_receiver_ = std::make_unique<RtpVideoReceiver>();
|
||||||
rtp_video_receiver_->SetOnReceiveCompleteFrame(
|
rtp_video_receiver_->SetOnReceiveCompleteFrame(
|
||||||
[this](VideoFrame &video_frame) -> void {
|
[this](VideoFrame &video_frame) -> void {
|
||||||
@@ -211,8 +211,8 @@ int IceTransmission::SendData(const char *data, size_t size) {
|
|||||||
if (JUICE_STATE_COMPLETED == state_) {
|
if (JUICE_STATE_COMPLETED == state_) {
|
||||||
std::vector<RtpPacket> packets;
|
std::vector<RtpPacket> packets;
|
||||||
|
|
||||||
if (rtp_video_session_) {
|
if (rtp_codec_) {
|
||||||
rtp_video_session_->Encode((uint8_t *)data, size, packets);
|
rtp_codec_->Encode((uint8_t *)data, size, packets);
|
||||||
}
|
}
|
||||||
if (rtp_video_sender_) {
|
if (rtp_video_sender_) {
|
||||||
rtp_video_sender_->Enqueue(packets);
|
rtp_video_sender_->Enqueue(packets);
|
||||||
@@ -223,7 +223,7 @@ int IceTransmission::SendData(const char *data, size_t size) {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// std::vector<RtpPacket> packets =
|
// std::vector<RtpPacket> packets =
|
||||||
// rtp_video_session_->Encode((uint8_t *)(data), size);
|
// rtp_codec_->Encode((uint8_t *)(data), size);
|
||||||
|
|
||||||
// send_ringbuffer_.insert(send_ringbuffer_.end(), packets.begin(),
|
// send_ringbuffer_.insert(send_ringbuffer_.end(), packets.begin(),
|
||||||
// packets.end());
|
// packets.end());
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
#include "congestion_control.h"
|
#include "congestion_control.h"
|
||||||
#include "ice_agent.h"
|
#include "ice_agent.h"
|
||||||
#include "ringbuffer.h"
|
#include "ringbuffer.h"
|
||||||
|
#include "rtp_codec.h"
|
||||||
#include "rtp_packet.h"
|
#include "rtp_packet.h"
|
||||||
#include "rtp_video_receiver.h"
|
#include "rtp_video_receiver.h"
|
||||||
#include "rtp_video_sender.h"
|
#include "rtp_video_sender.h"
|
||||||
#include "rtp_video_session.h"
|
|
||||||
#include "ws_transmission.h"
|
#include "ws_transmission.h"
|
||||||
|
|
||||||
class IceTransmission {
|
class IceTransmission {
|
||||||
@@ -72,7 +72,7 @@ class IceTransmission {
|
|||||||
juice_state_t state_ = JUICE_STATE_DISCONNECTED;
|
juice_state_t state_ = JUICE_STATE_DISCONNECTED;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<RtpVideoSession> rtp_video_session_ = nullptr;
|
std::unique_ptr<RtpCodec> rtp_codec_ = nullptr;
|
||||||
std::unique_ptr<RtpVideoReceiver> rtp_video_receiver_ = nullptr;
|
std::unique_ptr<RtpVideoReceiver> rtp_video_receiver_ = nullptr;
|
||||||
std::unique_ptr<RtpVideoSender> rtp_video_sender_ = nullptr;
|
std::unique_ptr<RtpVideoSender> rtp_video_sender_ = nullptr;
|
||||||
uint8_t *rtp_payload_ = nullptr;
|
uint8_t *rtp_payload_ = nullptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user