FrameBuffer2 now has Start/Stop methods.

The Stop method is used to signal any thread that is waiting in the
NextFrame function and will cause it to return immediately.

BUG=webrtc:5514
R=pbos@webrtc.org

Review URL: https://codereview.webrtc.org/2105323002 .

Cr-Commit-Position: refs/heads/master@{#13349}
This commit is contained in:
philipel
2016-06-30 17:33:02 +02:00
parent 039083aedc
commit 504c47d750
2 changed files with 49 additions and 23 deletions

View File

@ -46,6 +46,14 @@ class FrameBuffer {
// unique ptr if there is no available frame for decoding.
std::unique_ptr<FrameObject> NextFrame(int64_t max_wait_time_ms);
// Start the frame buffer, has no effect if the frame buffer is started.
// The frame buffer is started upon construction.
void Start();
// Stop the frame buffer, causing any sleeping thread in NextFrame to
// return immediately.
void Stop();
private:
// FrameKey is a pair of (picture id, spatial layer).
using FrameKey = std::pair<uint16_t, uint8_t>;
@ -73,6 +81,7 @@ class FrameBuffer {
VCMJitterEstimator* const jitter_estimator_;
const VCMTiming* const timing_;
int newest_picture_id_ GUARDED_BY(crit_);
bool stopped_ GUARDED_BY(crit_);
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FrameBuffer);
};