Clear the FrameBuffer if it's full and a keyframe is being inserted.

Bug: webrtc:7705, webrtc:8593, chromium:706599, chromium:807624
Change-Id: Ie4e3e217bc2930fe511f8b6ad3a36afed484ab5f
Reviewed-on: https://webrtc-review.googlesource.com/59321
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22304}
This commit is contained in:
philipel
2018-03-02 11:06:27 +01:00
committed by Commit Bot
parent 8ddc2e6258
commit 9771c5050d
2 changed files with 30 additions and 6 deletions

View File

@ -319,12 +319,21 @@ int64_t FrameBuffer::InsertFrame(std::unique_ptr<EncodedFrame> frame) {
}
if (num_frames_buffered_ >= kMaxFramesBuffered) {
RTC_LOG(LS_WARNING) << "Frame with (picture_id:spatial_id) ("
<< key.picture_id << ":"
<< static_cast<int>(key.spatial_layer)
<< ") could not be inserted due to the frame "
<< "buffer being full, dropping frame.";
return last_continuous_picture_id;
if (frame->is_keyframe()) {
RTC_LOG(LS_WARNING) << "Inserting keyframe (picture_id:spatial_id) ("
<< key.picture_id << ":"
<< static_cast<int>(key.spatial_layer)
<< ") but buffer is full, clearing"
<< " buffer and inserting the frame.";
ClearFramesAndHistory();
} else {
RTC_LOG(LS_WARNING) << "Frame with (picture_id:spatial_id) ("
<< key.picture_id << ":"
<< static_cast<int>(key.spatial_layer)
<< ") could not be inserted due to the frame "
<< "buffer being full, dropping frame.";
return last_continuous_picture_id;
}
}
if (last_decoded_frame_it_ != frames_.end() &&