mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
[fix] use ntp timestamp ms as video rtp timestamp
This commit is contained in:
@@ -48,7 +48,7 @@ void AudioChannelSend::Destroy() {
|
||||
int AudioChannelSend::SendAudio(char *data, size_t size) {
|
||||
if (rtp_audio_sender_ && rtp_packetizer_) {
|
||||
std::vector<std::shared_ptr<RtpPacket>> rtp_packets =
|
||||
rtp_packetizer_->Build((uint8_t *)data, (uint32_t)size, true);
|
||||
rtp_packetizer_->Build((uint8_t *)data, (uint32_t)size, 0, true);
|
||||
rtp_audio_sender_->Enqueue(rtp_packets);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ void DataChannelSend::Destroy() {
|
||||
int DataChannelSend::SendData(const char *data, size_t size) {
|
||||
if (rtp_data_sender_ && rtp_packetizer_) {
|
||||
std::vector<std::shared_ptr<RtpPacket>> rtp_packets =
|
||||
rtp_packetizer_->Build((uint8_t *)data, (uint32_t)size, true);
|
||||
rtp_packetizer_->Build((uint8_t *)data, (uint32_t)size, 0, true);
|
||||
rtp_data_sender_->Enqueue(rtp_packets);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ RtpVideoSender::~RtpVideoSender() {
|
||||
|
||||
void RtpVideoSender::Enqueue(
|
||||
std::vector<std::shared_ptr<RtpPacket>>& rtp_packets,
|
||||
int64_t capture_timestamp) {
|
||||
int64_t capture_timestamp_ms) {
|
||||
if (!rtp_statistics_) {
|
||||
rtp_statistics_ = std::make_unique<RtpStatistics>();
|
||||
rtp_statistics_->Start();
|
||||
@@ -55,7 +55,7 @@ void RtpVideoSender::Enqueue(
|
||||
std::shared_ptr<webrtc::RtpPacketToSend> rtp_packet_to_send =
|
||||
std::dynamic_pointer_cast<webrtc::RtpPacketToSend>(rtp_packet);
|
||||
rtp_packet_to_send->set_capture_time(
|
||||
webrtc::Timestamp::Millis(capture_timestamp));
|
||||
webrtc::Timestamp::Millis(capture_timestamp_ms));
|
||||
rtp_packet_to_send->set_transport_sequence_number(transport_seq_++);
|
||||
rtp_packet_to_send->set_packet_type(webrtc::RtpPacketMediaType::kVideo);
|
||||
rtp_packet_queue_.push(std::move(rtp_packet_to_send));
|
||||
@@ -93,7 +93,7 @@ int RtpVideoSender::SendRtpPacket(
|
||||
|
||||
#ifdef SAVE_RTP_SENT_STREAM
|
||||
fwrite((unsigned char*)rtp_packet_to_send->Payload(), 1,
|
||||
rtp_packet_to_send->PayloadSize(), file_rtp_sent_);
|
||||
x rtp_packet_to_send->PayloadSize(), file_rtp_sent_);
|
||||
#endif
|
||||
|
||||
last_send_bytes_ += (uint32_t)rtp_packet_to_send->Size();
|
||||
|
||||
@@ -23,7 +23,7 @@ class RtpVideoSender : public ThreadBase {
|
||||
|
||||
public:
|
||||
void Enqueue(std::vector<std::shared_ptr<RtpPacket>> &rtp_packets,
|
||||
int64_t capture_timestamp);
|
||||
int64_t capture_timestamp_ms);
|
||||
void SetSendDataFunc(std::function<int(const char *, size_t)> data_send_func);
|
||||
void SetOnSentPacketFunc(
|
||||
std::function<void(const webrtc::RtpPacketToSend &)> on_sent_packet_func);
|
||||
|
||||
@@ -62,7 +62,8 @@ int VideoChannelSend::SendVideo(
|
||||
if (rtp_video_sender_ && rtp_packetizer_) {
|
||||
std::vector<std::shared_ptr<RtpPacket>> rtp_packets =
|
||||
rtp_packetizer_->Build((uint8_t*)encoded_frame->Buffer(),
|
||||
(uint32_t)encoded_frame->Size(), true);
|
||||
(uint32_t)encoded_frame->Size(),
|
||||
encoded_frame->CaptureTimestamp(), true);
|
||||
rtp_video_sender_->Enqueue(rtp_packets, encoded_frame->CaptureTimestamp());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user