Index: webrtc/common_video/video_render_frames.cc |
diff --git a/webrtc/common_video/video_render_frames.cc b/webrtc/common_video/video_render_frames.cc |
index 62b317d966bee1e1cd7c081558574ae512b75089..b818512acb1c93b8080bab0a2059fcd4fa58d440 100644 |
--- a/webrtc/common_video/video_render_frames.cc |
+++ b/webrtc/common_video/video_render_frames.cc |
@@ -17,14 +17,21 @@ |
#include "webrtc/system_wrappers/include/trace.h" |
namespace webrtc { |
+namespace { |
-const uint32_t KEventMaxWaitTimeMs = 200; |
+const uint32_t kEventMaxWaitTimeMs = 200; |
const uint32_t kMinRenderDelayMs = 10; |
const uint32_t kMaxRenderDelayMs = 500; |
-VideoRenderFrames::VideoRenderFrames() |
- : render_delay_ms_(10) { |
+uint32_t EnsureValidRenderDelay(uint32_t render_delay) { |
+ return (render_delay < kMinRenderDelayMs || render_delay > kMaxRenderDelayMs) |
+ ? kMinRenderDelayMs |
+ : render_delay; |
} |
+} // namespace |
+ |
+VideoRenderFrames::VideoRenderFrames(uint32_t render_delay_ms) |
+ : render_delay_ms_(EnsureValidRenderDelay(render_delay_ms)) {} |
int32_t VideoRenderFrames::AddFrame(const VideoFrame& new_frame) { |
const int64_t time_now = rtc::TimeMillis(); |
@@ -63,14 +70,9 @@ rtc::Optional<VideoFrame> VideoRenderFrames::FrameToRender() { |
return render_frame; |
} |
-int32_t VideoRenderFrames::ReleaseAllFrames() { |
- incoming_frames_.clear(); |
- return 0; |
-} |
- |
uint32_t VideoRenderFrames::TimeToNextFrameRelease() { |
if (incoming_frames_.empty()) { |
- return KEventMaxWaitTimeMs; |
+ return kEventMaxWaitTimeMs; |
} |
const int64_t time_to_release = incoming_frames_.front().render_time_ms() - |
render_delay_ms_ - |
@@ -78,18 +80,4 @@ uint32_t VideoRenderFrames::TimeToNextFrameRelease() { |
return time_to_release < 0 ? 0u : static_cast<uint32_t>(time_to_release); |
} |
-int32_t VideoRenderFrames::SetRenderDelay( |
- const uint32_t render_delay) { |
- if (render_delay < kMinRenderDelayMs || |
- render_delay > kMaxRenderDelayMs) { |
- WEBRTC_TRACE(kTraceWarning, kTraceVideoRenderer, |
- -1, "%s(%d): Invalid argument.", __FUNCTION__, |
- render_delay); |
- return -1; |
- } |
- |
- render_delay_ms_ = render_delay; |
- return 0; |
-} |
- |
} // namespace webrtc |