Revert "Remove extra copy in VideoCaptureImpl::IncomingFrameI420"
This reverts commit 99f9743fe39066ba93b41f2b0a417696cbbd06fb.
Revert while build breakage is fixed.
BUG=None
TBR=niklas.emblom@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/3249004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@5069 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/common_video/plane.h b/common_video/plane.h
index 89de5d7..1b74f37 100644
--- a/common_video/plane.h
+++ b/common_video/plane.h
@@ -25,26 +25,23 @@
// CreateEmptyPlane - set allocated size, actual plane size and stride:
// If current size is smaller than current size, then a buffer of sufficient
// size will be allocated.
- // Return value: 0 on success, -1 on error.
- int CreateEmptyPlane(size_t allocated_size, size_t stride, size_t plane_size);
+ // Return value: 0 on success ,-1 on error.
+ int CreateEmptyPlane(int allocated_size, int stride, int plane_size);
// Copy the entire plane data.
- // Return value: 0 on success, -1 on error.
+ // Return value: 0 on success ,-1 on error.
int Copy(const Plane& plane);
// Copy buffer: If current size is smaller
// than current size, then a buffer of sufficient size will be allocated.
- // Return value: 0 on success, -1 on error.
- int Copy(size_t size, size_t stride, const uint8_t* buffer);
-
- // Make this plane refer to a memory buffer. Plane will not own buffer.
- void Alias(size_t size, size_t stride, uint8_t* buffer);
+ // Return value: 0 on success ,-1 on error.
+ int Copy(int size, int stride, const uint8_t* buffer);
// Swap plane data.
void Swap(Plane& plane);
// Get allocated size.
- size_t allocated_size() const { return allocated_size_; }
+ int allocated_size() const {return allocated_size_;}
// Set actual size.
void ResetSize() {plane_size_ = 0;}
@@ -53,24 +50,23 @@
bool IsZeroSize() const {return plane_size_ == 0;}
// Get stride value.
- size_t stride() const { return stride_; }
+ int stride() const {return stride_;}
// Return data pointer.
- const uint8_t* buffer() const { return pointer_; }
+ const uint8_t* buffer() const {return buffer_.get();}
// Overloading with non-const.
- uint8_t* buffer() { return pointer_; }
+ uint8_t* buffer() {return buffer_.get();}
private:
- // Reallocate when needed: If current allocated size is less than new_size,
- // buffer will be updated. In any case, old data becomes undefined.
- // Return value: 0 on success, -1 on error.
- int Reallocate(size_t new_size);
+ // Resize when needed: If current allocated size is less than new_size, buffer
+ // will be updated. Old data will be copied to new buffer.
+ // Return value: 0 on success ,-1 on error.
+ int MaybeResize(int new_size);
- uint8_t* pointer_;
- Allocator<uint8_t>::scoped_ptr_aligned allocation_;
- size_t allocated_size_;
- size_t plane_size_;
- size_t stride_;
+ Allocator<uint8_t>::scoped_ptr_aligned buffer_;
+ int allocated_size_;
+ int plane_size_;
+ int stride_;
}; // Plane
} // namespace webrtc