Revert "I420VideoFrame: Remove functions set_width, set_height, and ResetSize"

This reverts commit r8434.

Reason for revert: Introduced a race condition. If ViECaptureProcess() -> SwapCapturedAndDeliverFrameIfAvailable() is called twice without a call to OnIncomingCapturedFrame() in between (with both captured_frame_ and deliver_frame_ populated), an old frame will be delivered again, since captured_frame_->IsZeroSize() will never be true.

BUG=4352
TBR=perkj@webrtc.org, stefan@webrtc.org, tommi@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/40129004

Cr-Commit-Position: refs/heads/master@{#8530}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8530 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
magjed@webrtc.org
2015-02-27 15:18:26 +00:00
parent 4b3618c7f3
commit 7400e0b876
13 changed files with 84 additions and 20 deletions

View File

@ -111,6 +111,12 @@ class I420VideoFrame {
// Get allocated stride per plane.
virtual int stride(PlaneType type) const;
// Set frame width.
virtual int set_width(int width);
// Set frame height.
virtual int set_height(int height);
// Get frame width.
virtual int width() const { return width_; }
@ -157,6 +163,10 @@ class I420VideoFrame {
// Return true if underlying plane buffers are of zero size, false if not.
virtual bool IsZeroSize() const;
// Reset underlying plane buffers sizes to 0. This function doesn't
// clear memory.
virtual void ResetSize();
// Return the handle of the underlying video frame. This is used when the
// frame is backed by a texture. The object should be destroyed when it is no
// longer in use, so the underlying resource can be freed.
@ -170,8 +180,6 @@ class I420VideoFrame {
int stride_y,
int stride_u,
int stride_v);
int width_;
int height_;
private:
// Get the pointer to a specific plane.
@ -182,6 +190,8 @@ class I420VideoFrame {
Plane y_plane_;
Plane u_plane_;
Plane v_plane_;
int width_;
int height_;
uint32_t timestamp_;
int64_t ntp_time_ms_;
int64_t render_time_ms_;