Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Unified Diff: webrtc/modules/video_coding/packet_buffer.cc

Issue 2853503002: Dont request keyframes if the stream is inactive or if we are currently receiving a keyframe. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/video_coding/packet_buffer.cc
diff --git a/webrtc/modules/video_coding/packet_buffer.cc b/webrtc/modules/video_coding/packet_buffer.cc
index 3b0d09f042efc77ec7cb77a92b33877d0493237a..a052d18d6bc6098f89b8c3e3fb81d1a804a5681a 100644
--- a/webrtc/modules/video_coding/packet_buffer.cc
+++ b/webrtc/modules/video_coding/packet_buffer.cc
@@ -59,6 +59,11 @@ bool PacketBuffer::InsertPacket(VCMPacket* packet) {
std::vector<std::unique_ptr<RtpFrameObject>> found_frames;
{
rtc::CritScope lock(&crit_);
+ int64_t now_ms = clock_->TimeInMilliseconds();
+ last_received_packet_ms_ = rtc::Optional<int64_t>(now_ms);
+ if (packet->frameType == kVideoFrameKey)
+ last_received_keyframe_packet_ms_ = rtc::Optional<int64_t>(now_ms);
+
uint16_t seq_num = packet->seqNum;
size_t index = seq_num % size_;
@@ -143,6 +148,18 @@ void PacketBuffer::Clear() {
first_packet_received_ = false;
is_cleared_to_first_seq_num_ = false;
+ last_received_packet_ms_ = rtc::Optional<int64_t>();
+ last_received_keyframe_packet_ms_ = rtc::Optional<int64_t>();
+}
+
+rtc::Optional<int64_t> PacketBuffer::LastReceivedPacketMs() const {
+ rtc::CritScope lock(&crit_);
+ return last_received_packet_ms_;
+}
+
+rtc::Optional<int64_t> PacketBuffer::LastReceivedKeyframePacketMs() const {
+ rtc::CritScope lock(&crit_);
+ return last_received_keyframe_packet_ms_;
}
bool PacketBuffer::ExpandBufferSize() {

Powered by Google App Engine
This is Rietveld 408576698