formats: Make get_nal_header_from_fu_headers pure virtual in h26x

This commit is contained in:
Joni Räsänen 2022-08-15 09:05:33 +03:00
parent 471e5f64f6
commit 8272b26ab8
4 changed files with 12 additions and 11 deletions

View File

@ -89,6 +89,15 @@ uvgrtp::formats::FRAG_TYPE uvgrtp::formats::h265::get_fragment_type(uvgrtp::fram
return uvgrtp::formats::FRAG_TYPE::FT_MIDDLE;
}
void uvgrtp::formats::h265::get_nal_header_from_fu_headers(size_t fptr, uint8_t* frame_payload, uint8_t* complete_payload)
{
uint8_t payload_header[2] = {
(uint8_t)((frame_payload[0] & 0x81) | ((frame_payload[2] & 0x3f) << 1)),
(uint8_t)frame_payload[1]
};
std::memcpy(&complete_payload[fptr], payload_header, get_payload_header_size());
}
void uvgrtp::formats::h265::clear_aggregation_info()
{

View File

@ -69,6 +69,8 @@ namespace uvgrtp {
virtual uvgrtp::formats::FRAG_TYPE get_fragment_type(uvgrtp::frame::rtp_frame* frame) const;
virtual uvgrtp::formats::NAL_TYPE get_nal_type(uvgrtp::frame::rtp_frame* frame) const;
virtual void get_nal_header_from_fu_headers(size_t fptr, uint8_t* frame_payload, uint8_t* complete_payload);
private:
h265_aggregation_packet aggr_pkt_info_;
};

View File

@ -721,16 +721,6 @@ rtp_error_t uvgrtp::formats::h26x::packet_handler(int flags, uvgrtp::frame::rtp_
return RTP_OK; // no frame was completed, but everything went ok for this fragment
}
void uvgrtp::formats::h26x::get_nal_header_from_fu_headers(size_t fptr, uint8_t* frame_payload, uint8_t* complete_payload)
{
uint8_t payload_header[2] = {
(uint8_t)((frame_payload[0] & 0x81) | ((frame_payload[2] & 0x3f) << 1)),
(uint8_t)frame_payload[1]
};
std::memcpy(&complete_payload[fptr], payload_header, get_payload_header_size());
}
void uvgrtp::formats::h26x::garbage_collect_lost_frames(size_t timout)
{
if (uvgrtp::clock::hrc::diff_now(last_garbage_collection_) >= GARBAGE_COLLECTION_INTERVAL_MS) {

View File

@ -144,7 +144,7 @@ namespace uvgrtp {
virtual uvgrtp::formats::FRAG_TYPE get_fragment_type(uvgrtp::frame::rtp_frame* frame) const = 0;
virtual uvgrtp::formats::NAL_TYPE get_nal_type(uvgrtp::frame::rtp_frame* frame) const = 0;
virtual void get_nal_header_from_fu_headers(size_t fptr, uint8_t* frame_payload, uint8_t* complete_payload);
virtual void get_nal_header_from_fu_headers(size_t fptr, uint8_t* frame_payload, uint8_t* complete_payload) = 0;
virtual uvgrtp::frame::rtp_frame* allocate_rtp_frame_with_startcode(bool add_start_code,
uvgrtp::frame::rtp_header& header, size_t payload_size_without_startcode, size_t& fptr);