Added RtpFrameObject ctor with no PacketBuffer pointer.
Bug: webrtc:10979
Change-Id: Ie6a2b56e7374d60d1f74d8c315216b27df22a19b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/154426
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29314}
diff --git a/modules/video_coding/frame_object.cc b/modules/video_coding/frame_object.cc
index 581fb58..f16d132 100644
--- a/modules/video_coding/frame_object.cc
+++ b/modules/video_coding/frame_object.cc
@@ -24,6 +24,7 @@
namespace webrtc {
namespace video_coding {
+// TODO(philipel): Remove this ctor.
RtpFrameObject::RtpFrameObject(
PacketBuffer* packet_buffer,
uint16_t first_seq_num,
@@ -109,6 +110,78 @@
is_last_spatial_layer = last_packet->markerBit;
}
+RtpFrameObject::RtpFrameObject(
+ uint16_t first_seq_num,
+ uint16_t last_seq_num,
+ bool markerBit,
+ int times_nacked,
+ int64_t first_packet_received_time,
+ int64_t last_packet_received_time,
+ uint32_t rtp_timestamp,
+ int64_t ntp_time_ms,
+ const VideoSendTiming& timing,
+ uint8_t payload_type,
+ VideoCodecType codec,
+ VideoRotation rotation,
+ VideoContentType content_type,
+ const RTPVideoHeader& video_header,
+ const absl::optional<webrtc::ColorSpace>& color_space,
+ const absl::optional<RtpGenericFrameDescriptor>& generic_descriptor,
+ RtpPacketInfos packet_infos,
+ rtc::scoped_refptr<EncodedImageBuffer> image_buffer)
+ : first_seq_num_(first_seq_num),
+ last_seq_num_(last_seq_num),
+ last_packet_received_time_(last_packet_received_time),
+ times_nacked_(times_nacked) {
+ rtp_video_header_ = video_header;
+ rtp_generic_frame_descriptor_ = generic_descriptor;
+
+ // EncodedFrame members
+ codec_type_ = codec;
+
+ // TODO(philipel): Remove when encoded image is replaced by EncodedFrame.
+ // VCMEncodedFrame members
+ CopyCodecSpecific(&rtp_video_header_);
+ _completeFrame = true;
+ _payloadType = payload_type;
+ SetTimestamp(rtp_timestamp);
+ ntp_time_ms_ = ntp_time_ms;
+ _frameType = rtp_video_header_.frame_type;
+
+ // Setting frame's playout delays to the same values
+ // as of the first packet's.
+ SetPlayoutDelay(rtp_video_header_.playout_delay);
+
+ SetEncodedData(std::move(image_buffer));
+ _encodedWidth = rtp_video_header_.width;
+ _encodedHeight = rtp_video_header_.height;
+
+ // EncodedFrame members
+ SetPacketInfos(std::move(packet_infos));
+
+ rotation_ = rotation;
+ SetColorSpace(color_space);
+ _rotation_set = true;
+ content_type_ = content_type;
+ if (timing.flags != VideoSendTiming::kInvalid) {
+ // ntp_time_ms_ may be -1 if not estimated yet. This is not a problem,
+ // as this will be dealt with at the time of reporting.
+ timing_.encode_start_ms = ntp_time_ms_ + timing.encode_start_delta_ms;
+ timing_.encode_finish_ms = ntp_time_ms_ + timing.encode_finish_delta_ms;
+ timing_.packetization_finish_ms =
+ ntp_time_ms_ + timing.packetization_finish_delta_ms;
+ timing_.pacer_exit_ms = ntp_time_ms_ + timing.pacer_exit_delta_ms;
+ timing_.network_timestamp_ms =
+ ntp_time_ms_ + timing.network_timestamp_delta_ms;
+ timing_.network2_timestamp_ms =
+ ntp_time_ms_ + timing.network2_timestamp_delta_ms;
+ }
+ timing_.receive_start_ms = first_packet_received_time;
+ timing_.receive_finish_ms = last_packet_received_time;
+ timing_.flags = timing.flags;
+ is_last_spatial_layer = markerBit;
+}
+
RtpFrameObject::~RtpFrameObject() {
}
diff --git a/modules/video_coding/frame_object.h b/modules/video_coding/frame_object.h
index 17d0994..8020b49 100644
--- a/modules/video_coding/frame_object.h
+++ b/modules/video_coding/frame_object.h
@@ -22,6 +22,7 @@
class RtpFrameObject : public EncodedFrame {
public:
+ // TODO(philipel): Remove this ctor.
RtpFrameObject(PacketBuffer* packet_buffer,
uint16_t first_seq_num,
uint16_t last_seq_num,
@@ -31,6 +32,26 @@
RtpPacketInfos packet_infos,
rtc::scoped_refptr<EncodedImageBuffer> image_buffer);
+ RtpFrameObject(
+ uint16_t first_seq_num,
+ uint16_t last_seq_num,
+ bool markerBit,
+ int times_nacked,
+ int64_t first_packet_received_time,
+ int64_t last_packet_received_time,
+ uint32_t rtp_timestamp,
+ int64_t ntp_time_ms,
+ const VideoSendTiming& timing,
+ uint8_t payload_type,
+ VideoCodecType codec,
+ VideoRotation rotation,
+ VideoContentType content_type,
+ const RTPVideoHeader& video_header,
+ const absl::optional<webrtc::ColorSpace>& color_space,
+ const absl::optional<RtpGenericFrameDescriptor>& generic_descriptor,
+ RtpPacketInfos packet_infos,
+ rtc::scoped_refptr<EncodedImageBuffer> image_buffer);
+
~RtpFrameObject() override;
uint16_t first_seq_num() const;
uint16_t last_seq_num() const;
diff --git a/modules/video_coding/packet_buffer.cc b/modules/video_coding/packet_buffer.cc
index a046b54..1ca488d 100644
--- a/modules/video_coding/packet_buffer.cc
+++ b/modules/video_coding/packet_buffer.cc
@@ -426,9 +426,18 @@
missing_packets_.erase(missing_packets_.begin(),
missing_packets_.upper_bound(seq_num));
+ const VCMPacket* first_packet = GetPacket(start_seq_num);
+ const VCMPacket* last_packet = GetPacket(seq_num);
auto frame = std::make_unique<RtpFrameObject>(
- this, start_seq_num, seq_num, max_nack_count, min_recv_time,
- max_recv_time, RtpPacketInfos(std::move(packet_infos)),
+ start_seq_num, seq_num, last_packet->markerBit, max_nack_count,
+ min_recv_time, max_recv_time, first_packet->timestamp,
+ first_packet->ntp_time_ms_, last_packet->video_header.video_timing,
+ first_packet->payloadType, first_packet->codec(),
+ last_packet->video_header.rotation,
+ last_packet->video_header.content_type, first_packet->video_header,
+ last_packet->video_header.color_space,
+ first_packet->generic_descriptor,
+ RtpPacketInfos(std::move(packet_infos)),
GetEncodedImageBuffer(frame_size, start_seq_num, seq_num));
found_frames.emplace_back(std::move(frame));