Calculate min and max receive timestamps for packets in a video frame
Bug: webrtc:10106 Change-Id: I1d3469abb1e7bb7c91a5912d7b781505526abaca Reviewed-on: https://webrtc-review.googlesource.com/c/113507 Reviewed-by: Sebastian Jansson <srte@webrtc.org> Reviewed-by: Philip Eliasson <philipel@webrtc.org> Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25935}
This commit is contained in:
committed by
Commit Bot
parent
48a79465ec
commit
4348ce240a
@ -27,11 +27,12 @@ RtpFrameObject::RtpFrameObject(PacketBuffer* packet_buffer,
|
||||
uint16_t last_seq_num,
|
||||
size_t frame_size,
|
||||
int times_nacked,
|
||||
int64_t received_time)
|
||||
int64_t first_packet_received_time,
|
||||
int64_t last_packet_received_time)
|
||||
: packet_buffer_(packet_buffer),
|
||||
first_seq_num_(first_seq_num),
|
||||
last_seq_num_(last_seq_num),
|
||||
received_time_(received_time),
|
||||
last_packet_received_time_(last_packet_received_time),
|
||||
times_nacked_(times_nacked) {
|
||||
VCMPacket* first_packet = packet_buffer_->GetPacket(first_seq_num);
|
||||
RTC_CHECK(first_packet);
|
||||
@ -100,9 +101,9 @@ RtpFrameObject::RtpFrameObject(PacketBuffer* packet_buffer,
|
||||
ntp_time_ms_ +
|
||||
last_packet->video_header.video_timing.network2_timestamp_delta_ms;
|
||||
}
|
||||
timing_.receive_start_ms = first_packet_received_time;
|
||||
timing_.receive_finish_ms = last_packet_received_time;
|
||||
timing_.flags = last_packet->video_header.video_timing.flags;
|
||||
timing_.receive_start_ms = first_packet->receive_time_ms;
|
||||
timing_.receive_finish_ms = last_packet->receive_time_ms;
|
||||
is_last_spatial_layer = last_packet->markerBit;
|
||||
}
|
||||
|
||||
@ -131,7 +132,7 @@ VideoCodecType RtpFrameObject::codec_type() const {
|
||||
}
|
||||
|
||||
int64_t RtpFrameObject::ReceivedTime() const {
|
||||
return received_time_;
|
||||
return last_packet_received_time_;
|
||||
}
|
||||
|
||||
int64_t RtpFrameObject::RenderTime() const {
|
||||
|
||||
@ -29,7 +29,8 @@ class RtpFrameObject : public EncodedFrame {
|
||||
uint16_t last_seq_num,
|
||||
size_t frame_size,
|
||||
int times_nacked,
|
||||
int64_t received_time);
|
||||
int64_t first_packet_received_time,
|
||||
int64_t last_packet_received_time);
|
||||
|
||||
~RtpFrameObject() override;
|
||||
uint16_t first_seq_num() const;
|
||||
@ -53,7 +54,7 @@ class RtpFrameObject : public EncodedFrame {
|
||||
VideoCodecType codec_type_;
|
||||
uint16_t first_seq_num_;
|
||||
uint16_t last_seq_num_;
|
||||
int64_t received_time_;
|
||||
int64_t last_packet_received_time_;
|
||||
|
||||
// Equal to times nacked of the packet with the highet times nacked
|
||||
// belonging to this frame.
|
||||
|
||||
@ -285,6 +285,8 @@ std::vector<std::unique_ptr<RtpFrameObject>> PacketBuffer::FindFrames(
|
||||
size_t frame_size = 0;
|
||||
int max_nack_count = -1;
|
||||
uint16_t start_seq_num = seq_num;
|
||||
int64_t min_recv_time = data_buffer_[index].receive_time_ms;
|
||||
int64_t max_recv_time = data_buffer_[index].receive_time_ms;
|
||||
|
||||
// Find the start index by searching backward until the packet with
|
||||
// the |frame_begin| flag is set.
|
||||
@ -306,6 +308,11 @@ std::vector<std::unique_ptr<RtpFrameObject>> PacketBuffer::FindFrames(
|
||||
std::max(max_nack_count, data_buffer_[start_index].timesNacked);
|
||||
sequence_buffer_[start_index].frame_created = true;
|
||||
|
||||
min_recv_time =
|
||||
std::min(min_recv_time, data_buffer_[start_index].receive_time_ms);
|
||||
max_recv_time =
|
||||
std::max(max_recv_time, data_buffer_[start_index].receive_time_ms);
|
||||
|
||||
if (!is_h264 && sequence_buffer_[start_index].frame_begin)
|
||||
break;
|
||||
|
||||
@ -393,7 +400,7 @@ std::vector<std::unique_ptr<RtpFrameObject>> PacketBuffer::FindFrames(
|
||||
|
||||
found_frames.emplace_back(
|
||||
new RtpFrameObject(this, start_seq_num, seq_num, frame_size,
|
||||
max_nack_count, clock_->TimeInMilliseconds()));
|
||||
max_nack_count, min_recv_time, max_recv_time));
|
||||
}
|
||||
++seq_num;
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ class TestRtpFrameReferenceFinder : public ::testing::Test,
|
||||
ref_packet_buffer_->InsertPacket(&packet);
|
||||
|
||||
std::unique_ptr<RtpFrameObject> frame(new RtpFrameObject(
|
||||
ref_packet_buffer_, seq_num_start, seq_num_end, 0, 0, 0));
|
||||
ref_packet_buffer_, seq_num_start, seq_num_end, 0, 0, 0, 0));
|
||||
reference_finder_->ManageFrame(std::move(frame));
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ class TestRtpFrameReferenceFinder : public ::testing::Test,
|
||||
}
|
||||
|
||||
std::unique_ptr<RtpFrameObject> frame(new RtpFrameObject(
|
||||
ref_packet_buffer_, seq_num_start, seq_num_end, 0, 0, 0));
|
||||
ref_packet_buffer_, seq_num_start, seq_num_end, 0, 0, 0, 0));
|
||||
reference_finder_->ManageFrame(std::move(frame));
|
||||
}
|
||||
|
||||
@ -164,7 +164,7 @@ class TestRtpFrameReferenceFinder : public ::testing::Test,
|
||||
}
|
||||
|
||||
std::unique_ptr<RtpFrameObject> frame(new RtpFrameObject(
|
||||
ref_packet_buffer_, seq_num_start, seq_num_end, 0, 0, 0));
|
||||
ref_packet_buffer_, seq_num_start, seq_num_end, 0, 0, 0, 0));
|
||||
reference_finder_->ManageFrame(std::move(frame));
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ class TestRtpFrameReferenceFinder : public ::testing::Test,
|
||||
}
|
||||
|
||||
std::unique_ptr<RtpFrameObject> frame(new RtpFrameObject(
|
||||
ref_packet_buffer_, seq_num_start, seq_num_end, 0, 0, 0));
|
||||
ref_packet_buffer_, seq_num_start, seq_num_end, 0, 0, 0, 0));
|
||||
reference_finder_->ManageFrame(std::move(frame));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user