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

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

Issue 2394823002: Skip non-continuous FrameInfos when finding the next frame to return from FrameBuffer::NextFrame. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | webrtc/modules/video_coding/frame_buffer2_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_coding/frame_buffer2.cc
diff --git a/webrtc/modules/video_coding/frame_buffer2.cc b/webrtc/modules/video_coding/frame_buffer2.cc
index b2b4c213fe56122ede4477231aaae6378bc4e82c..8bb19ba003210968eacd4370c33717ebabad1a50 100644
--- a/webrtc/modules/video_coding/frame_buffer2.cc
+++ b/webrtc/modules/video_coding/frame_buffer2.cc
@@ -85,8 +85,10 @@ FrameBuffer::ReturnReason FrameBuffer::NextFrame(
++continuous_end_it;
for (; frame_it != continuous_end_it; ++frame_it) {
- if (frame_it->second.num_missing_decodable > 0)
+ if (!frame_it->second.continuous ||
+ frame_it->second.num_missing_decodable > 0) {
continue;
+ }
FrameObject* frame = frame_it->second.frame.get();
next_frame_it = frame_it;
@@ -151,6 +153,8 @@ void FrameBuffer::Stop() {
int FrameBuffer::InsertFrame(std::unique_ptr<FrameObject> frame) {
rtc::CritScope lock(&crit_);
+ RTC_DCHECK(frame);
+
FrameKey key(frame->picture_id, frame->spatial_layer);
int last_continuous_picture_id =
last_continuous_frame_it_ == frames_.end()
@@ -186,11 +190,16 @@ int FrameBuffer::InsertFrame(std::unique_ptr<FrameObject> frame) {
auto info = frames_.insert(std::make_pair(key, FrameInfo())).first;
- if (!UpdateFrameInfoWithIncomingFrame(*frame, info)) {
- frames_.erase(info);
+ if (info->second.frame) {
+ LOG(LS_WARNING) << "Frame with (picture_id:spatial_id) (" << key.picture_id
+ << ":" << static_cast<int>(key.spatial_layer)
+ << ") already inserted, dropping frame.";
return last_continuous_picture_id;
}
+ if (!UpdateFrameInfoWithIncomingFrame(*frame, info))
+ return last_continuous_picture_id;
+
info->second.frame = std::move(frame);
++num_frames_buffered_;
@@ -241,6 +250,7 @@ void FrameBuffer::PropagateContinuity(FrameMap::iterator start) {
void FrameBuffer::PropagateDecodability(const FrameInfo& info) {
for (size_t d = 0; d < info.num_dependent_frames; ++d) {
auto ref_info = frames_.find(info.dependent_frames[d]);
+ RTC_DCHECK(ref_info != frames_.end());
stefan-webrtc 2016/10/05 14:02:49 NE?
philipel 2016/10/05 14:30:01 Sorry, comparing iterators don't work with the DCH
RTC_DCHECK_GT(ref_info->second.num_missing_decodable, 0U);
--ref_info->second.num_missing_decodable;
}
@@ -311,6 +321,8 @@ bool FrameBuffer::UpdateFrameInfoWithIncomingFrame(const FrameObject& frame,
key;
++ref_info->second.num_dependent_frames;
}
+ RTC_DCHECK_LE(ref_info->second.num_missing_continuous,
+ ref_info->second.num_missing_decodable);
}
// Check if we have the lower spatial layer frame.
@@ -331,8 +343,13 @@ bool FrameBuffer::UpdateFrameInfoWithIncomingFrame(const FrameObject& frame,
key;
++ref_info->second.num_dependent_frames;
}
+ RTC_DCHECK_LE(ref_info->second.num_missing_continuous,
+ ref_info->second.num_missing_decodable);
}
+ RTC_DCHECK_LE(info->second.num_missing_continuous,
+ info->second.num_missing_decodable);
+
return true;
}
« no previous file with comments | « no previous file | webrtc/modules/video_coding/frame_buffer2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698