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 b818512acb1c93b8080bab0a2059fcd4fa58d440..62b317d966bee1e1cd7c081558574ae512b75089 100644 |
--- a/webrtc/common_video/video_render_frames.cc |
+++ b/webrtc/common_video/video_render_frames.cc |
@@ -17,21 +17,14 @@ |
#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; |
-uint32_t EnsureValidRenderDelay(uint32_t render_delay) { |
- return (render_delay < kMinRenderDelayMs || render_delay > kMaxRenderDelayMs) |
- ? kMinRenderDelayMs |
- : render_delay; |
+VideoRenderFrames::VideoRenderFrames() |
+ : render_delay_ms_(10) { |
} |
-} // 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(); |
@@ -70,9 +63,14 @@ |
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_ - |
@@ -80,4 +78,18 @@ |
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 |