2016-04-20 05:25:10 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef MODULES_RTP_RTCP_SOURCE_RTP_PACKET_TO_SEND_H_
|
|
|
|
|
#define MODULES_RTP_RTCP_SOURCE_RTP_PACKET_TO_SEND_H_
|
2016-04-20 05:25:10 -07:00
|
|
|
|
2018-02-22 14:18:06 +01:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
#include "api/array_view.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/rtp_rtcp/source/rtp_header_extensions.h"
|
|
|
|
|
#include "modules/rtp_rtcp/source/rtp_packet.h"
|
2016-04-20 05:25:10 -07:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
// Class to hold rtp packet with metadata for sender side.
|
2017-09-14 14:08:22 +02:00
|
|
|
class RtpPacketToSend : public RtpPacket {
|
2016-04-20 05:25:10 -07:00
|
|
|
public:
|
2018-02-22 14:18:06 +01:00
|
|
|
explicit RtpPacketToSend(const ExtensionManager* extensions);
|
|
|
|
|
RtpPacketToSend(const RtpPacketToSend& packet);
|
|
|
|
|
RtpPacketToSend(const ExtensionManager* extensions, size_t capacity);
|
|
|
|
|
|
|
|
|
|
RtpPacketToSend& operator=(const RtpPacketToSend& packet);
|
2016-04-20 05:25:10 -07:00
|
|
|
|
2018-02-22 14:18:06 +01:00
|
|
|
~RtpPacketToSend();
|
2017-06-19 07:18:55 -07:00
|
|
|
|
2016-04-20 05:25:10 -07:00
|
|
|
// Time in local time base as close as it can to frame capture time.
|
|
|
|
|
int64_t capture_time_ms() const { return capture_time_ms_; }
|
2017-06-19 07:18:55 -07:00
|
|
|
|
2016-04-20 05:25:10 -07:00
|
|
|
void set_capture_time_ms(int64_t time) { capture_time_ms_ = time; }
|
|
|
|
|
|
2018-02-22 14:18:06 +01:00
|
|
|
// Additional data bound to the RTP packet for use in application code,
|
|
|
|
|
// outside of WebRTC.
|
|
|
|
|
rtc::ArrayView<const uint8_t> application_data() const {
|
|
|
|
|
return application_data_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void set_application_data(rtc::ArrayView<const uint8_t> data) {
|
|
|
|
|
application_data_.assign(data.begin(), data.end());
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-19 07:18:55 -07:00
|
|
|
void set_packetization_finish_time_ms(int64_t time) {
|
|
|
|
|
SetExtension<VideoTimingExtension>(
|
2017-07-06 03:06:50 -07:00
|
|
|
VideoSendTiming::GetDeltaCappedMs(capture_time_ms_, time),
|
2017-08-18 02:51:12 -07:00
|
|
|
VideoSendTiming::kPacketizationFinishDeltaOffset);
|
2017-06-19 07:18:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void set_pacer_exit_time_ms(int64_t time) {
|
|
|
|
|
SetExtension<VideoTimingExtension>(
|
2017-07-06 03:06:50 -07:00
|
|
|
VideoSendTiming::GetDeltaCappedMs(capture_time_ms_, time),
|
2017-08-18 02:51:12 -07:00
|
|
|
VideoSendTiming::kPacerExitDeltaOffset);
|
2017-06-19 07:18:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void set_network_time_ms(int64_t time) {
|
|
|
|
|
SetExtension<VideoTimingExtension>(
|
2017-07-06 03:06:50 -07:00
|
|
|
VideoSendTiming::GetDeltaCappedMs(capture_time_ms_, time),
|
2017-08-18 02:51:12 -07:00
|
|
|
VideoSendTiming::kNetworkTimestampDeltaOffset);
|
2017-06-19 07:18:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void set_network2_time_ms(int64_t time) {
|
|
|
|
|
SetExtension<VideoTimingExtension>(
|
2017-07-06 03:06:50 -07:00
|
|
|
VideoSendTiming::GetDeltaCappedMs(capture_time_ms_, time),
|
2017-08-18 02:51:12 -07:00
|
|
|
VideoSendTiming::kNetwork2TimestampDeltaOffset);
|
2017-06-19 07:18:55 -07:00
|
|
|
}
|
|
|
|
|
|
2016-04-20 05:25:10 -07:00
|
|
|
private:
|
|
|
|
|
int64_t capture_time_ms_ = 0;
|
2018-02-22 14:18:06 +01:00
|
|
|
std::vector<uint8_t> application_data_;
|
2016-04-20 05:25:10 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // MODULES_RTP_RTCP_SOURCE_RTP_PACKET_TO_SEND_H_
|