Introduce DecodedFramesHistory class and use it in FrameBuffer

This is a space efficient way to store more records about decoded frames,
which is needed for long term references.

Bug: webrtc:9710
Change-Id: I051d59d34a966d48db011142466d9cd15304b7d9
Reviewed-on: https://webrtc-review.googlesource.com/c/116792
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26240}
This commit is contained in:
Ilya Nikolaevskiy
2019-01-14 13:24:22 +01:00
committed by Commit Bot
parent d0f0f68953
commit 13717842df
6 changed files with 319 additions and 49 deletions

View File

@ -14,7 +14,6 @@
#include <array>
#include <map>
#include <memory>
#include <set>
#include <utility>
#include <vector>
@ -22,6 +21,7 @@
#include "api/video/encoded_frame.h"
#include "modules/video_coding/include/video_coding_defines.h"
#include "modules/video_coding/inter_frame_delay.h"
#include "modules/video_coding/utility/decoded_frames_history.h"
#include "rtc_base/constructor_magic.h"
#include "rtc_base/critical_section.h"
#include "rtc_base/event.h"
@ -132,10 +132,6 @@ class FrameBuffer {
void PropagateDecodability(const FrameInfo& info)
RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_);
// Removes undecodable frames and moves decoded frame to the history.
void AdvanceLastDecodedFrame(FrameMap::iterator decoded)
RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_);
// Update the corresponding FrameInfo of |frame| and all FrameInfos that
// |frame| references.
// Return false if |frame| will never be decodable, true otherwise.
@ -161,7 +157,7 @@ class FrameBuffer {
// Stores only undecoded frames.
FrameMap frames_ RTC_GUARDED_BY(crit_);
std::set<VideoLayerFrameId> decoded_frames_history_ RTC_GUARDED_BY(crit_);
DecodedFramesHistory decoded_frames_history_ RTC_GUARDED_BY(crit_);
rtc::CriticalSection crit_;
Clock* const clock_;
@ -169,8 +165,6 @@ class FrameBuffer {
VCMJitterEstimator* const jitter_estimator_ RTC_GUARDED_BY(crit_);
VCMTiming* const timing_ RTC_GUARDED_BY(crit_);
VCMInterFrameDelay inter_frame_delay_ RTC_GUARDED_BY(crit_);
absl::optional<uint32_t> last_decoded_frame_timestamp_ RTC_GUARDED_BY(crit_);
absl::optional<VideoLayerFrameId> last_decoded_frame_ RTC_GUARDED_BY(crit_);
absl::optional<VideoLayerFrameId> last_continuous_frame_
RTC_GUARDED_BY(crit_);
std::vector<FrameMap::iterator> frames_to_decode_ RTC_GUARDED_BY(crit_);