mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
[fix] fix h264 frame assember
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
#include "nack.h"
|
#include "nack.h"
|
||||||
#include "rtcp_sender.h"
|
#include "rtcp_sender.h"
|
||||||
|
|
||||||
#define SAVE_RTP_RECV_STREAM
|
// #define SAVE_RTP_RECV_STREAM
|
||||||
|
|
||||||
#define NV12_BUFFER_SIZE (1280 * 720 * 3 / 2)
|
#define NV12_BUFFER_SIZE (1280 * 720 * 3 / 2)
|
||||||
#define RTCP_RR_INTERVAL 1000
|
#define RTCP_RR_INTERVAL 1000
|
||||||
@@ -200,6 +200,18 @@ void RtpVideoReceiver::InsertRtpPacket(RtpPacket& rtp_packet) {
|
|||||||
if (rtp_packet.Buffer().data() != nullptr && rtp_packet.Size() > 0 &&
|
if (rtp_packet.Buffer().data() != nullptr && rtp_packet.Size() > 0 &&
|
||||||
rtp_packet_h264->Build(rtp_packet.Buffer().data(), rtp_packet.Size())) {
|
rtp_packet_h264->Build(rtp_packet.Buffer().data(), rtp_packet.Size())) {
|
||||||
rtp_packet_h264->GetFrameHeaderInfo();
|
rtp_packet_h264->GetFrameHeaderInfo();
|
||||||
|
rtp::NAL_UNIT_TYPE nalu_type = rtp_packet_h264->NalUnitType();
|
||||||
|
if (rtp::NAL_UNIT_TYPE::NALU == nalu_type) {
|
||||||
|
ReceivedFrame received_frame(rtp_packet_h264->Payload(),
|
||||||
|
rtp_packet_h264->PayloadSize());
|
||||||
|
received_frame.SetReceivedTimestamp(clock_->CurrentTime().us());
|
||||||
|
received_frame.SetCapturedTimestamp(
|
||||||
|
(static_cast<int64_t>(rtp_packet_h264->Timestamp()) /
|
||||||
|
rtp::kMsToRtpTimestamp -
|
||||||
|
delta_ntp_internal_ms_) *
|
||||||
|
1000);
|
||||||
|
compelete_video_frame_queue_.push(received_frame);
|
||||||
|
} else if (rtp::NAL_UNIT_TYPE::FU_A == nalu_type) {
|
||||||
std::vector<std::unique_ptr<RtpPacketH264>> complete_frame =
|
std::vector<std::unique_ptr<RtpPacketH264>> complete_frame =
|
||||||
h264_frame_assembler_.InsertPacket(std::move(rtp_packet_h264));
|
h264_frame_assembler_.InsertPacket(std::move(rtp_packet_h264));
|
||||||
if (!complete_frame.empty()) {
|
if (!complete_frame.empty()) {
|
||||||
@@ -221,12 +233,10 @@ void RtpVideoReceiver::InsertRtpPacket(RtpPacket& rtp_packet) {
|
|||||||
1000);
|
1000);
|
||||||
compelete_video_frame_queue_.push(received_frame);
|
compelete_video_frame_queue_.push(received_frame);
|
||||||
|
|
||||||
fwrite((unsigned char*)received_frame.Buffer(), 1,
|
|
||||||
received_frame.Size(), file_rtp_recv_);
|
|
||||||
|
|
||||||
delete[] nv12_data_;
|
delete[] nv12_data_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// RtpPacketH264 rtp_packet_h264;
|
// RtpPacketH264 rtp_packet_h264;
|
||||||
// if (rtp_packet_h264.Build(rtp_packet.Buffer().data(), rtp_packet.Size()))
|
// if (rtp_packet_h264.Build(rtp_packet.Buffer().data(), rtp_packet.Size()))
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "rtc_base/network/sent_packet.h"
|
#include "rtc_base/network/sent_packet.h"
|
||||||
|
|
||||||
#define SAVE_RTP_SENT_STREAM
|
// #define SAVE_RTP_SENT_STREAM
|
||||||
|
|
||||||
VideoChannelSend::VideoChannelSend(
|
VideoChannelSend::VideoChannelSend(
|
||||||
std::shared_ptr<SystemClock> clock, std::shared_ptr<IceAgent> ice_agent,
|
std::shared_ptr<SystemClock> clock, std::shared_ptr<IceAgent> ice_agent,
|
||||||
|
|||||||
Reference in New Issue
Block a user