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>
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
#define FU_A 28
|
||||
#define FU_B 29
|
||||
|
||||
RtpVideoSession ::RtpVideoSession(PAYLOAD_TYPE payload_type)
|
||||
RtpCodec ::RtpCodec(PAYLOAD_TYPE payload_type)
|
||||
: version_(RTP_VERSION),
|
||||
has_padding_(false),
|
||||
has_extension_(false),
|
||||
payload_type_(payload_type),
|
||||
sequence_number_(0) {}
|
||||
|
||||
RtpVideoSession ::~RtpVideoSession() {
|
||||
RtpCodec ::~RtpCodec() {
|
||||
if (extension_data_) {
|
||||
delete extension_data_;
|
||||
extension_data_ = nullptr;
|
||||
@@ -28,7 +28,7 @@ RtpVideoSession ::~RtpVideoSession() {
|
||||
// }
|
||||
}
|
||||
|
||||
void RtpVideoSession::Encode(uint8_t* buffer, size_t size,
|
||||
void RtpCodec::Encode(uint8_t* buffer, size_t size,
|
||||
std::vector<RtpPacket>& packets) {
|
||||
// if (!rtp_packet_) {
|
||||
// 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) {
|
||||
// LOG_ERROR("End bit!!!!!!!!!!!!!!!");
|
||||
// }
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef _RTP_VIDEO_SESSION_H_
|
||||
#define _RTP_VIDEO_SESSION_H_
|
||||
#ifndef _RTP_CODEC_H_
|
||||
#define _RTP_CODEC_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
#include "rtp_packet.h"
|
||||
|
||||
class RtpVideoSession {
|
||||
class RtpCodec {
|
||||
public:
|
||||
RtpVideoSession(PAYLOAD_TYPE payload_type);
|
||||
~RtpVideoSession();
|
||||
RtpCodec(PAYLOAD_TYPE payload_type);
|
||||
~RtpCodec();
|
||||
|
||||
public:
|
||||
void Encode(uint8_t* buffer, size_t size, std::vector<RtpPacket>& packets);
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "frame.h"
|
||||
#include "ringbuffer.h"
|
||||
#include "rtp_video_session.h"
|
||||
#include "rtp_codec.h"
|
||||
#include "thread_base.h"
|
||||
|
||||
class RtpVideoReceiver : public ThreadBase {
|
||||
|
||||
@@ -47,7 +47,7 @@ IceTransmission::~IceTransmission() {
|
||||
}
|
||||
|
||||
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_->SetOnReceiveCompleteFrame(
|
||||
[this](VideoFrame &video_frame) -> void {
|
||||
@@ -211,8 +211,8 @@ int IceTransmission::SendData(const char *data, size_t size) {
|
||||
if (JUICE_STATE_COMPLETED == state_) {
|
||||
std::vector<RtpPacket> packets;
|
||||
|
||||
if (rtp_video_session_) {
|
||||
rtp_video_session_->Encode((uint8_t *)data, size, packets);
|
||||
if (rtp_codec_) {
|
||||
rtp_codec_->Encode((uint8_t *)data, size, packets);
|
||||
}
|
||||
if (rtp_video_sender_) {
|
||||
rtp_video_sender_->Enqueue(packets);
|
||||
@@ -223,7 +223,7 @@ int IceTransmission::SendData(const char *data, size_t size) {
|
||||
// }
|
||||
|
||||
// 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(),
|
||||
// packets.end());
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
#include "congestion_control.h"
|
||||
#include "ice_agent.h"
|
||||
#include "ringbuffer.h"
|
||||
#include "rtp_codec.h"
|
||||
#include "rtp_packet.h"
|
||||
#include "rtp_video_receiver.h"
|
||||
#include "rtp_video_sender.h"
|
||||
#include "rtp_video_session.h"
|
||||
#include "ws_transmission.h"
|
||||
|
||||
class IceTransmission {
|
||||
@@ -72,7 +72,7 @@ class IceTransmission {
|
||||
juice_state_t state_ = JUICE_STATE_DISCONNECTED;
|
||||
|
||||
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<RtpVideoSender> rtp_video_sender_ = nullptr;
|
||||
uint8_t *rtp_payload_ = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user