Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Unified Diff: webrtc/modules/video_coding/frame_buffer2.cc

Issue 2302473002: FrameBuffer::NextFrame now return pair<frame, reason>. (Closed)
Patch Set: Comment fix Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/video_coding/frame_buffer2.h ('k') | webrtc/modules/video_coding/frame_buffer2_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_coding/frame_buffer2.cc
diff --git a/webrtc/modules/video_coding/frame_buffer2.cc b/webrtc/modules/video_coding/frame_buffer2.cc
index dab783254684e2ff140ed598bd3fdc022f9dbd57..766e6a05d722ddc2811f47763d9a1f49711093ec 100644
--- a/webrtc/modules/video_coding/frame_buffer2.cc
+++ b/webrtc/modules/video_coding/frame_buffer2.cc
@@ -52,7 +52,9 @@ FrameBuffer::FrameBuffer(Clock* clock,
stopped_(false),
protection_mode_(kProtectionNack) {}
-std::unique_ptr<FrameObject> FrameBuffer::NextFrame(int64_t max_wait_time_ms) {
+FrameBuffer::ReturnReason FrameBuffer::NextFrame(
+ int64_t max_wait_time_ms,
+ std::unique_ptr<FrameObject>* frame_out) {
int64_t latest_return_time = clock_->TimeInMilliseconds() + max_wait_time_ms;
int64_t now = clock_->TimeInMilliseconds();
int64_t wait_ms = max_wait_time_ms;
@@ -63,7 +65,7 @@ std::unique_ptr<FrameObject> FrameBuffer::NextFrame(int64_t max_wait_time_ms) {
rtc::CritScope lock(&crit_);
frame_inserted_event_.Reset();
if (stopped_)
- return std::unique_ptr<FrameObject>();
+ return kStopped;
now = clock_->TimeInMilliseconds();
wait_ms = max_wait_time_ms;
@@ -115,9 +117,10 @@ std::unique_ptr<FrameObject> FrameBuffer::NextFrame(int64_t max_wait_time_ms) {
decoded_frames_.insert(next_frame_it->first);
std::unique_ptr<FrameObject> frame = std::move(next_frame_it->second);
frames_.erase(frames_.begin(), ++next_frame_it);
- return frame;
+ *frame_out = std::move(frame);
+ return kFrameFound;
} else {
- return std::unique_ptr<FrameObject>();
+ return kTimeout;
}
}
}
« no previous file with comments | « webrtc/modules/video_coding/frame_buffer2.h ('k') | webrtc/modules/video_coding/frame_buffer2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698