From 7de81e2717c4ed9dccdda4d103eef4aeafb07088 Mon Sep 17 00:00:00 2001 From: Evan Shrubsole Date: Wed, 10 Nov 2021 11:35:10 +0100 Subject: [PATCH] Add const to methods in DecodedFramesHistory Bug: webrtc:13343 Change-Id: I3f4e015e683f4003bb038424646cb51ae26c76fa Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/236848 Reviewed-by: Philip Eliasson Commit-Queue: Evan Shrubsole Cr-Commit-Position: refs/heads/main@{#35329} --- modules/video_coding/utility/decoded_frames_history.cc | 7 ++++--- modules/video_coding/utility/decoded_frames_history.h | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/video_coding/utility/decoded_frames_history.cc b/modules/video_coding/utility/decoded_frames_history.cc index 005bb26ea6..1138aa8448 100644 --- a/modules/video_coding/utility/decoded_frames_history.cc +++ b/modules/video_coding/utility/decoded_frames_history.cc @@ -50,7 +50,7 @@ void DecodedFramesHistory::InsertDecoded(int64_t frame_id, uint32_t timestamp) { last_frame_id_ = frame_id; } -bool DecodedFramesHistory::WasDecoded(int64_t frame_id) { +bool DecodedFramesHistory::WasDecoded(int64_t frame_id) const { if (!last_frame_id_) return false; @@ -74,11 +74,12 @@ void DecodedFramesHistory::Clear() { last_frame_id_.reset(); } -absl::optional DecodedFramesHistory::GetLastDecodedFrameId() { +absl::optional DecodedFramesHistory::GetLastDecodedFrameId() const { return last_decoded_frame_; } -absl::optional DecodedFramesHistory::GetLastDecodedFrameTimestamp() { +absl::optional DecodedFramesHistory::GetLastDecodedFrameTimestamp() + const { return last_decoded_frame_timestamp_; } diff --git a/modules/video_coding/utility/decoded_frames_history.h b/modules/video_coding/utility/decoded_frames_history.h index 06008dc22e..9b8bf65821 100644 --- a/modules/video_coding/utility/decoded_frames_history.h +++ b/modules/video_coding/utility/decoded_frames_history.h @@ -31,12 +31,12 @@ class DecodedFramesHistory { void InsertDecoded(int64_t frame_id, uint32_t timestamp); // Query if the following (frame_id, spatial_id) pair was inserted before. // Should be at most less by window_size-1 than the last inserted frame id. - bool WasDecoded(int64_t frame_id); + bool WasDecoded(int64_t frame_id) const; void Clear(); - absl::optional GetLastDecodedFrameId(); - absl::optional GetLastDecodedFrameTimestamp(); + absl::optional GetLastDecodedFrameId() const; + absl::optional GetLastDecodedFrameTimestamp() const; private: int FrameIdToIndex(int64_t frame_id) const;