mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
[fix] fix h264 rtp packet packetization and depacketization
This commit is contained in:
11
src/rtp/rtp_depacketizer/rtp_depacketizer.cpp
Normal file
11
src/rtp/rtp_depacketizer/rtp_depacketizer.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "rtp_depacketizer.h"
|
||||
|
||||
std::shared_ptr<RtpDepacketizer> Create(uint32_t payload_type, uint8_t* payload,
|
||||
size_t payload_size) {
|
||||
switch (payload_type) {
|
||||
case rtp::PAYLOAD_TYPE::H264:
|
||||
return std::make_shared<RtpDepacketizerH264>(payload, payload_size);
|
||||
case rtp::PAYLOAD_TYPE::AV1:
|
||||
return std::make_shared<RtpDepacketizerAv1>(payload, payload_size);
|
||||
}
|
||||
}
|
||||
25
src/rtp/rtp_depacketizer/rtp_depacketizer.h
Normal file
25
src/rtp/rtp_depacketizer/rtp_depacketizer.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* @Author: DI JUNKUN
|
||||
* @Date: 2025-01-23
|
||||
* Copyright (c) 2025 by DI JUNKUN, All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef _RTP_DEPACKETIZER_H_
|
||||
#define _RTP_DEPACKETIZER_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
#include "rtp_packet.h"
|
||||
|
||||
class RtpDepacketizer {
|
||||
public:
|
||||
static std::shared_ptr<RtpDepacketizer> Create(uint32_t payload_type);
|
||||
|
||||
virtual ~RtpDepacketizer() = default;
|
||||
|
||||
bool Build(uint8_t* payload, uint32_t payload_size) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
9
src/rtp/rtp_depacketizer/rtp_depacketizer_h264.cpp
Normal file
9
src/rtp/rtp_depacketizer/rtp_depacketizer_h264.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "rtp_depacketizer_h264.h"
|
||||
|
||||
RtpDepacketizerH264::RtpDepacketizerH264() {}
|
||||
|
||||
RtpDepacketizerH264::~RtpDepacketizerH264() {}
|
||||
|
||||
bool RtpDepacketizerH264::Parse(uint8_t* payload, uint32_t payload_size) {
|
||||
return true;
|
||||
}
|
||||
25
src/rtp/rtp_depacketizer/rtp_depacketizer_h264.h
Normal file
25
src/rtp/rtp_depacketizer/rtp_depacketizer_h264.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* @Author: DI JUNKUN
|
||||
* @Date: 2025-01-23
|
||||
* Copyright (c) 2025 by DI JUNKUN, All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef _RTP_DEPACKETIZER_H_
|
||||
#define _RTP_DEPACKETIZER_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
#include "rtp_packet.h"
|
||||
|
||||
class RtpDepacketizerH264 {
|
||||
public:
|
||||
RtpDepacketizerH264();
|
||||
|
||||
virtual ~RtpDepacketizerH264() = default;
|
||||
|
||||
bool Parse(uint8_t* payload, uint32_t payload_size);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user