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}
This commit is contained in:
philipel
2019-09-25 17:15:37 +02:00
committed by Commit Bot
parent 2bc55585f6
commit 85d5c197a8
3 changed files with 105 additions and 2 deletions

View File

@ -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 @@ RtpFrameObject::RtpFrameObject(
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() {
}

View File

@ -22,6 +22,7 @@ class PacketBuffer;
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 @@ class RtpFrameObject : public EncodedFrame {
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;

View File

@ -426,9 +426,18 @@ std::vector<std::unique_ptr<RtpFrameObject>> PacketBuffer::FindFrames(
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));