I420VideoFrame.CreateFrame: Removed unnecessary buffer size arguments.

R=magjed@webrtc.org, tommi@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#8732}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8732 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/talk/app/webrtc/java/jni/androidmediadecoder_jni.cc b/talk/app/webrtc/java/jni/androidmediadecoder_jni.cc
index df943ff..92c5856 100644
--- a/talk/app/webrtc/java/jni/androidmediadecoder_jni.cc
+++ b/talk/app/webrtc/java/jni/androidmediadecoder_jni.cc
@@ -581,9 +581,8 @@
     // Create yuv420 frame.
     if (color_format == COLOR_FormatYUV420Planar) {
       decoded_image_.CreateFrame(
-          stride * slice_height, payload,
-          (stride * slice_height) / 4, payload + (stride * slice_height),
-          (stride * slice_height) / 4,
+          payload,
+          payload + (stride * slice_height),
           payload + (5 * stride * slice_height / 4),
           width, height,
           stride, stride / 2, stride / 2);
diff --git a/webrtc/common_video/i420_video_frame.cc b/webrtc/common_video/i420_video_frame.cc
index 9e87e40..edc5112 100644
--- a/webrtc/common_video/i420_video_frame.cc
+++ b/webrtc/common_video/i420_video_frame.cc
@@ -80,21 +80,20 @@
   return 0;
 }
 
-int I420VideoFrame::CreateFrame(int size_y, const uint8_t* buffer_y,
-                                int size_u, const uint8_t* buffer_u,
-                                int size_v, const uint8_t* buffer_v,
+int I420VideoFrame::CreateFrame(const uint8_t* buffer_y,
+                                const uint8_t* buffer_u,
+                                const uint8_t* buffer_v,
                                 int width, int height,
-                                int stride_y, int stride_u, int stride_v) {
-  return CreateFrame(size_y, buffer_y, size_u, buffer_u, size_v, buffer_v,
+                                int stride_y,
+                                int stride_u,
+                                int stride_v) {
+  return CreateFrame(buffer_y, buffer_u, buffer_v,
                      width, height, stride_y, stride_u, stride_v,
                      kVideoRotation_0);
 }
 
-int I420VideoFrame::CreateFrame(int size_y,
-                                const uint8_t* buffer_y,
-                                int size_u,
+int I420VideoFrame::CreateFrame(const uint8_t* buffer_y,
                                 const uint8_t* buffer_u,
-                                int size_v,
                                 const uint8_t* buffer_v,
                                 int width,
                                 int height,
@@ -106,9 +105,6 @@
   const int expected_size_y = height * stride_y;
   const int expected_size_u = half_height * stride_u;
   const int expected_size_v = half_height * stride_v;
-  CHECK_GE(size_y, expected_size_y);
-  CHECK_GE(size_u, expected_size_u);
-  CHECK_GE(size_v, expected_size_v);
   if (CreateEmptyFrame(width, height, stride_y, stride_u, stride_v) < 0)
     return -1;
   memcpy(buffer(kYPlane), buffer_y, expected_size_y);
@@ -123,9 +119,9 @@
     video_frame_buffer_ = videoFrame.video_frame_buffer();
   } else {
     int ret = CreateFrame(
-        videoFrame.allocated_size(kYPlane), videoFrame.buffer(kYPlane),
-        videoFrame.allocated_size(kUPlane), videoFrame.buffer(kUPlane),
-        videoFrame.allocated_size(kVPlane), videoFrame.buffer(kVPlane),
+        videoFrame.buffer(kYPlane),
+        videoFrame.buffer(kUPlane),
+        videoFrame.buffer(kVPlane),
         videoFrame.width(), videoFrame.height(), videoFrame.stride(kYPlane),
         videoFrame.stride(kUPlane), videoFrame.stride(kVPlane));
     if (ret < 0)
diff --git a/webrtc/common_video/i420_video_frame_unittest.cc b/webrtc/common_video/i420_video_frame_unittest.cc
index 7c97713..d08b1b2 100644
--- a/webrtc/common_video/i420_video_frame_unittest.cc
+++ b/webrtc/common_video/i420_video_frame_unittest.cc
@@ -112,8 +112,8 @@
   memset(buffer_v, 4, kSizeV);
   I420VideoFrame big_frame;
   EXPECT_EQ(0,
-            big_frame.CreateFrame(kSizeY, buffer_y, kSizeU, buffer_u, kSizeV,
-                                  buffer_v, width + 5, height + 5, stride_y + 5,
+            big_frame.CreateFrame(buffer_y, buffer_u, buffer_v,
+                                  width + 5, height + 5, stride_y + 5,
                                   stride_u, stride_v, kRotation));
   // Frame of smaller dimensions.
   EXPECT_EQ(0, small_frame.CopyFrame(big_frame));
@@ -157,8 +157,7 @@
   memset(buffer_y, 16, kSizeY);
   memset(buffer_u, 8, kSizeU);
   memset(buffer_v, 4, kSizeV);
-  frame1.CreateFrame(
-      kSizeY, buffer_y, kSizeU, buffer_u, kSizeV, buffer_v, 20, 20, 20, 10, 10);
+  frame1.CreateFrame(buffer_y, buffer_u, buffer_v, 20, 20, 20, 10, 10);
   frame1.set_timestamp(1);
   frame1.set_ntp_time_ms(2);
   frame1.set_render_time_ms(3);
@@ -184,9 +183,7 @@
   memset(buffer_y, 16, kSizeY);
   memset(buffer_u, 8, kSizeUv);
   memset(buffer_v, 4, kSizeUv);
-  frame2.CreateFrame(kSizeY, buffer_y,
-                     kSizeUv, buffer_u,
-                     kSizeUv, buffer_v,
+  frame2.CreateFrame(buffer_y, buffer_u, buffer_v,
                      width, height, stride_y, stride_uv, stride_uv);
   // Expect exactly the same pixel data.
   EXPECT_TRUE(EqualPlane(buffer_y, frame2.buffer(kYPlane), stride_y, 15, 15));
@@ -236,9 +233,7 @@
   memset(buffer_y1, 2, kSizeY1);
   memset(buffer_u1, 4, kSizeU1);
   memset(buffer_v1, 8, kSizeV1);
-  frame1.CreateFrame(kSizeY1, buffer_y1,
-                     kSizeU1, buffer_u1,
-                     kSizeV1, buffer_v1,
+  frame1.CreateFrame(buffer_y1, buffer_u1, buffer_v1,
                      width1, height1, stride_y1, stride_u1, stride_v1);
   // Initialize frame2 values.
   EXPECT_EQ(0, frame2.CreateEmptyFrame(width2, height2,
@@ -253,9 +248,7 @@
   memset(buffer_y2, 0, kSizeY2);
   memset(buffer_u2, 1, kSizeU2);
   memset(buffer_v2, 2, kSizeV2);
-  frame2.CreateFrame(kSizeY2, buffer_y2,
-                     kSizeU2, buffer_u2,
-                     kSizeV2, buffer_v2,
+  frame2.CreateFrame(buffer_y2, buffer_u2, buffer_v2,
                      width2, height2, stride_y2, stride_u2, stride_v2);
   // Copy frames for subsequent comparison.
   I420VideoFrame frame1_copy, frame2_copy;
diff --git a/webrtc/common_video/libyuv/libyuv_unittest.cc b/webrtc/common_video/libyuv/libyuv_unittest.cc
index b2022f5..2480f1c 100644
--- a/webrtc/common_video/libyuv/libyuv_unittest.cc
+++ b/webrtc/common_video/libyuv/libyuv_unittest.cc
@@ -110,9 +110,9 @@
 
   EXPECT_EQ(frame_length_,
             fread(orig_buffer_.get(), 1, frame_length_, source_file_));
-  EXPECT_EQ(0, orig_frame_.CreateFrame(size_y_, orig_buffer_.get(),
-                                       size_uv_, orig_buffer_.get() + size_y_,
-                                       size_uv_, orig_buffer_.get() +
+  EXPECT_EQ(0, orig_frame_.CreateFrame(orig_buffer_.get(),
+                                       orig_buffer_.get() + size_y_,
+                                       orig_buffer_.get() +
                                        size_y_ + size_uv_,
                                        width_, height_,
                                        width_, (width_ + 1) / 2,
@@ -197,9 +197,9 @@
   rtc::scoped_ptr<uint8_t[]> res_i420_buffer(new uint8_t[frame_length_]);
   I420VideoFrame yv12_frame;
   EXPECT_EQ(0, ConvertFromI420(orig_frame_, kYV12, 0, outYV120Buffer.get()));
-  yv12_frame.CreateFrame(size_y_, outYV120Buffer.get(),
-                         size_uv_, outYV120Buffer.get() + size_y_,
-                         size_uv_, outYV120Buffer.get() + size_y_ + size_uv_,
+  yv12_frame.CreateFrame(outYV120Buffer.get(),
+                         outYV120Buffer.get() + size_y_,
+                         outYV120Buffer.get() + size_y_ + size_uv_,
                          width_, height_,
                          width_, (width_ + 1) / 2, (width_ + 1) / 2);
   EXPECT_EQ(0, ConvertFromYV12(yv12_frame, kI420, 0, res_i420_buffer.get()));
diff --git a/webrtc/common_video/libyuv/scaler_unittest.cc b/webrtc/common_video/libyuv/scaler_unittest.cc
index d8f7185..3906ef9 100644
--- a/webrtc/common_video/libyuv/scaler_unittest.cc
+++ b/webrtc/common_video/libyuv/scaler_unittest.cc
@@ -101,9 +101,9 @@
   I420VideoFrame test_frame2;
   rtc::scoped_ptr<uint8_t[]> orig_buffer(new uint8_t[frame_length_]);
   EXPECT_GT(fread(orig_buffer.get(), 1, frame_length_, source_file_), 0U);
-  test_frame_.CreateFrame(size_y_, orig_buffer.get(),
-                          size_uv_, orig_buffer.get() + size_y_,
-                          size_uv_, orig_buffer.get() + size_y_ + size_uv_,
+  test_frame_.CreateFrame(orig_buffer.get(),
+                          orig_buffer.get() + size_y_,
+                          orig_buffer.get() + size_y_ + size_uv_,
                           width_, height_,
                           width_, half_width_, half_width_);
   EXPECT_EQ(0, test_scaler_.Scale(test_frame_, &test_frame2));
@@ -353,9 +353,9 @@
         src_required_size)
       break;
 
-    input_frame.CreateFrame(size_y, frame_buffer.get(),
-                            size_uv, frame_buffer.get() + size_y,
-                            size_uv, frame_buffer.get() + size_y + size_uv,
+    input_frame.CreateFrame(frame_buffer.get(),
+                            frame_buffer.get() + size_y,
+                            frame_buffer.get() + size_y + size_uv,
                             src_width, src_height,
                             src_width, (src_width + 1) / 2,
                             (src_width + 1) / 2);
diff --git a/webrtc/modules/video_coding/codecs/test/videoprocessor.cc b/webrtc/modules/video_coding/codecs/test/videoprocessor.cc
index 07caf62..e67f586 100644
--- a/webrtc/modules/video_coding/codecs/test/videoprocessor.cc
+++ b/webrtc/modules/video_coding/codecs/test/videoprocessor.cc
@@ -185,9 +185,9 @@
     int half_width = (config_.codec_settings->width + 1) / 2;
     int half_height = (config_.codec_settings->height + 1) / 2;
     int size_uv = half_width * half_height;
-    source_frame_.CreateFrame(size_y, source_buffer_,
-                              size_uv, source_buffer_ + size_y,
-                              size_uv, source_buffer_ + size_y + size_uv,
+    source_frame_.CreateFrame(source_buffer_,
+                              source_buffer_ + size_y,
+                              source_buffer_ + size_y + size_uv,
                               config_.codec_settings->width,
                               config_.codec_settings->height,
                               config_.codec_settings->width,
diff --git a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc
index 2e5989d..d16eee8 100644
--- a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc
+++ b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc
@@ -1333,13 +1333,10 @@
   last_frame_width_ = img->d_w;
   last_frame_height_ = img->d_h;
   // Allocate memory for decoded image.
-  int size_y = img->stride[VPX_PLANE_Y] * img->d_h;
-  int size_u = img->stride[VPX_PLANE_U] * (img->d_h + 1) / 2;
-  int size_v = img->stride[VPX_PLANE_V] * (img->d_h + 1) / 2;
   // TODO(mikhal): This does  a copy - need to SwapBuffers.
-  decoded_image_.CreateFrame(size_y, img->planes[VPX_PLANE_Y],
-                             size_u, img->planes[VPX_PLANE_U],
-                             size_v, img->planes[VPX_PLANE_V],
+  decoded_image_.CreateFrame(img->planes[VPX_PLANE_Y],
+                             img->planes[VPX_PLANE_U],
+                             img->planes[VPX_PLANE_V],
                              img->d_w, img->d_h,
                              img->stride[VPX_PLANE_Y],
                              img->stride[VPX_PLANE_U],
diff --git a/webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc b/webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc
index 48b7305..95a52fe 100644
--- a/webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc
+++ b/webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc
@@ -472,13 +472,9 @@
     // Decoder OK and NULL image => No show frame.
     return WEBRTC_VIDEO_CODEC_NO_OUTPUT;
   }
-  int half_height = (img->d_h + 1) / 2;
-  int size_y = img->stride[VPX_PLANE_Y] * img->d_h;
-  int size_u = img->stride[VPX_PLANE_U] * half_height;
-  int size_v = img->stride[VPX_PLANE_V] * half_height;
-  decoded_image_.CreateFrame(size_y, img->planes[VPX_PLANE_Y],
-                             size_u, img->planes[VPX_PLANE_U],
-                             size_v, img->planes[VPX_PLANE_V],
+  decoded_image_.CreateFrame(img->planes[VPX_PLANE_Y],
+                             img->planes[VPX_PLANE_U],
+                             img->planes[VPX_PLANE_V],
                              img->d_w, img->d_h,
                              img->stride[VPX_PLANE_Y],
                              img->stride[VPX_PLANE_U],
diff --git a/webrtc/modules/video_coding/main/test/codec_database_test.cc b/webrtc/modules/video_coding/main/test/codec_database_test.cc
index 07342de..eee51fc 100644
--- a/webrtc/modules/video_coding/main/test/codec_database_test.cc
+++ b/webrtc/modules/video_coding/main/test/codec_database_test.cc
@@ -120,9 +120,9 @@
     int half_height = (_height + 1) / 2;
     int size_y = _width * _height;
     int size_uv = half_width * half_height;
-    sourceFrame.CreateFrame(size_y, tmpBuffer,
-                            size_uv, tmpBuffer + size_y,
-                            size_uv, tmpBuffer + size_y + size_uv,
+    sourceFrame.CreateFrame(tmpBuffer,
+                            tmpBuffer + size_y,
+                            tmpBuffer + size_y + size_uv,
                             _width, _height,
                             _width, half_width, half_width);
     _timeStamp += (uint32_t)(9e4 / _frameRate);
@@ -333,9 +333,9 @@
             {
                 frameCnt++;
                 TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0);
-                sourceFrame.CreateFrame(size_y, tmpBuffer,
-                                        size_uv, tmpBuffer + size_y,
-                                        size_uv, tmpBuffer + size_y + size_uv,
+                sourceFrame.CreateFrame(tmpBuffer,
+                                        tmpBuffer + size_y,
+                                        tmpBuffer + size_y + size_uv,
                                         _width, _height,
                                         _width, half_width, half_width);
                 _timeStamp += (uint32_t)(9e4 / _frameRate);
diff --git a/webrtc/modules/video_coding/main/test/generic_codec_test.cc b/webrtc/modules/video_coding/main/test/generic_codec_test.cc
index 48c65d7..b5d94f1 100644
--- a/webrtc/modules/video_coding/main/test/generic_codec_test.cc
+++ b/webrtc/modules/video_coding/main/test/generic_codec_test.cc
@@ -149,9 +149,9 @@
     int half_height = (_height + 1) / 2;
     int size_y = _width * _height;
     int size_uv = half_width * half_height;
-    sourceFrame.CreateFrame(size_y, tmpBuffer,
-                            size_uv, tmpBuffer + size_y,
-                            size_uv, tmpBuffer + size_y + size_uv,
+    sourceFrame.CreateFrame(tmpBuffer,
+                            tmpBuffer + size_y,
+                            tmpBuffer + size_y + size_uv,
                             _width, _height,
                             _width, half_width, half_width);
     sourceFrame.set_timestamp(_timeStamp++);
@@ -197,9 +197,9 @@
     for (i = 0; i < _frameRate; i++)
     {
         TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0);
-        sourceFrame.CreateFrame(size_y, tmpBuffer,
-                                size_uv, tmpBuffer + size_y,
-                                size_uv, tmpBuffer + size_y + size_uv,
+        sourceFrame.CreateFrame(tmpBuffer,
+                                tmpBuffer + size_y,
+                                tmpBuffer + size_y + size_uv,
                                 _width, _height,
                                 _width, half_width, half_width);
         _timeStamp += (uint32_t)(9e4 / static_cast<float>(_frameRate));
@@ -322,9 +322,9 @@
                 _lengthSourceFrame)
             {
                 _frameCnt++;
-                sourceFrame.CreateFrame(size_y, tmpBuffer,
-                                        size_uv, tmpBuffer + size_y,
-                                        size_uv, tmpBuffer + size_y + size_uv,
+                sourceFrame.CreateFrame(tmpBuffer,
+                                        tmpBuffer + size_y,
+                                        tmpBuffer + size_y + size_uv,
                                         _width, _height,
                                         _width, (_width + 1) / 2,
                                         (_width + 1) / 2);
@@ -387,9 +387,9 @@
         {
             TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0);
             _frameCnt++;
-            sourceFrame.CreateFrame(size_y, tmpBuffer,
-                                    size_uv, tmpBuffer + size_y,
-                                    size_uv, tmpBuffer + size_y + size_uv,
+            sourceFrame.CreateFrame(tmpBuffer,
+                                    tmpBuffer + size_y,
+                                    tmpBuffer + size_y + size_uv,
                                     _width, _height,
                                     _width, half_width, half_width);
             _timeStamp += (uint32_t)(9e4 / static_cast<float>(_frameRate));
@@ -441,9 +441,9 @@
     rewind(_sourceFile);
     while (fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) ==
         _lengthSourceFrame) {
-        sourceFrame.CreateFrame(size_y, tmpBuffer,
-                                size_uv, tmpBuffer + size_y,
-                                size_uv, tmpBuffer + size_y + size_uv,
+        sourceFrame.CreateFrame(tmpBuffer,
+                                tmpBuffer + size_y,
+                                tmpBuffer + size_y + size_uv,
                                 _width, _height,
                                 _width, half_width, half_width);
         _timeStamp += (uint32_t)(9e4 / static_cast<float>(_frameRate));
diff --git a/webrtc/modules/video_coding/main/test/media_opt_test.cc b/webrtc/modules/video_coding/main/test/media_opt_test.cc
index 4d4ff4c..16c0d7d 100644
--- a/webrtc/modules/video_coding/main/test/media_opt_test.cc
+++ b/webrtc/modules/video_coding/main/test/media_opt_test.cc
@@ -319,9 +319,9 @@
     {
         TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0);
         _frameCnt++;
-        sourceFrame.CreateFrame(size_y, tmpBuffer,
-                                size_uv, tmpBuffer + size_y,
-                                size_uv, tmpBuffer + size_y + size_uv,
+        sourceFrame.CreateFrame(tmpBuffer,
+                                tmpBuffer + size_y,
+                                tmpBuffer + size_y + size_uv,
                                 _width, _height,
                                 _width, half_width, half_width);
         _timeStamp += (uint32_t)(9e4 / static_cast<float>(_frameRate));
diff --git a/webrtc/modules/video_coding/main/test/mt_rx_tx_test.cc b/webrtc/modules/video_coding/main/test/mt_rx_tx_test.cc
index cd0c5b7..d1ac195 100644
--- a/webrtc/modules/video_coding/main/test/mt_rx_tx_test.cc
+++ b/webrtc/modules/video_coding/main/test/mt_rx_tx_test.cc
@@ -63,9 +63,9 @@
         int half_width = (width + 1) / 2;
         int half_height = (height + 1) / 2;
         int size_uv = half_width * half_height;
-        sourceFrame.CreateFrame(size_y, tmpBuffer,
-                                size_uv, tmpBuffer + size_y,
-                                size_uv, tmpBuffer + size_y + size_uv,
+        sourceFrame.CreateFrame(tmpBuffer,
+                                tmpBuffer + size_y,
+                                tmpBuffer + size_y + size_uv,
                                 width, height,
                                 width, half_width, half_width);
         state->_timestamp += (uint32_t)(9e4 / frameRate);
diff --git a/webrtc/modules/video_coding/main/test/normal_test.cc b/webrtc/modules/video_coding/main/test/normal_test.cc
index 9940e94..2de6845 100644
--- a/webrtc/modules/video_coding/main/test/normal_test.cc
+++ b/webrtc/modules/video_coding/main/test/normal_test.cc
@@ -286,9 +286,9 @@
     TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0 ||
          feof(_sourceFile));
     _frameCnt++;
-    sourceFrame.CreateFrame(size_y, tmpBuffer,
-                            size_uv, tmpBuffer + size_y,
-                            size_uv, tmpBuffer + size_y + size_uv,
+    sourceFrame.CreateFrame(tmpBuffer,
+                            tmpBuffer + size_y,
+                            tmpBuffer + size_y + size_uv,
                             _width, _height,
                             _width, half_width, half_width);
     _timeStamp +=
diff --git a/webrtc/modules/video_coding/main/test/quality_modes_test.cc b/webrtc/modules/video_coding/main/test/quality_modes_test.cc
index d584a47..5c06740 100644
--- a/webrtc/modules/video_coding/main/test/quality_modes_test.cc
+++ b/webrtc/modules/video_coding/main/test/quality_modes_test.cc
@@ -265,9 +265,9 @@
       _frameCnt++;
       int size_y = _nativeWidth * _nativeHeight;
       int size_uv = ((_nativeWidth + 1) / 2) * ((_nativeHeight  + 1) / 2);
-      sourceFrame.CreateFrame(size_y, tmpBuffer,
-                              size_uv, tmpBuffer + size_y,
-                              size_uv, tmpBuffer + size_y + size_uv,
+      sourceFrame.CreateFrame(tmpBuffer,
+                              tmpBuffer + size_y,
+                              tmpBuffer + size_y + size_uv,
                               _nativeWidth, _nativeHeight,
                               _nativeWidth, (_nativeWidth + 1) / 2,
                               (_nativeWidth + 1) / 2);
diff --git a/webrtc/video/video_send_stream_tests.cc b/webrtc/video/video_send_stream_tests.cc
index e13a78c..2c7242b 100644
--- a/webrtc/video/video_send_stream_tests.cc
+++ b/webrtc/video/video_send_stream_tests.cc
@@ -1090,14 +1090,10 @@
 I420VideoFrame* CreateI420VideoFrame(int width, int height, uint8_t data) {
   I420VideoFrame* frame = new I420VideoFrame();
   const int kSizeY = width * height * 2;
-  const int kSizeUV = width * height;
   rtc::scoped_ptr<uint8_t[]> buffer(new uint8_t[kSizeY]);
   memset(buffer.get(), data, kSizeY);
-  frame->CreateFrame(kSizeY,
+  frame->CreateFrame(buffer.get(),
                      buffer.get(),
-                     kSizeUV,
-                     buffer.get(),
-                     kSizeUV,
                      buffer.get(),
                      width,
                      height,
diff --git a/webrtc/video_engine/vie_capturer.cc b/webrtc/video_engine/vie_capturer.cc
index 2fb13de..c2eacb2 100644
--- a/webrtc/video_engine/vie_capturer.cc
+++ b/webrtc/video_engine/vie_capturer.cc
@@ -310,22 +310,16 @@
     return -1;
   }
 
-  int size_y = video_frame.height * video_frame.y_pitch;
-  int size_u = video_frame.u_pitch * ((video_frame.height + 1) / 2);
-  int size_v = video_frame.v_pitch * ((video_frame.height + 1) / 2);
   CriticalSectionScoped cs(incoming_frame_cs_.get());
-  int ret = incoming_frame_.CreateFrame(size_y,
-                                       video_frame.y_plane,
-                                       size_u,
-                                       video_frame.u_plane,
-                                       size_v,
-                                       video_frame.v_plane,
-                                       video_frame.width,
-                                       video_frame.height,
-                                       video_frame.y_pitch,
-                                       video_frame.u_pitch,
-                                       video_frame.v_pitch,
-                                       video_frame.rotation);
+  int ret = incoming_frame_.CreateFrame(video_frame.y_plane,
+                                        video_frame.u_plane,
+                                        video_frame.v_plane,
+                                        video_frame.width,
+                                        video_frame.height,
+                                        video_frame.y_pitch,
+                                        video_frame.u_pitch,
+                                        video_frame.v_pitch,
+                                        video_frame.rotation);
 
   if (ret < 0) {
     LOG_F(LS_ERROR) << "Could not create I420Frame.";
diff --git a/webrtc/video_engine/vie_capturer_unittest.cc b/webrtc/video_engine/vie_capturer_unittest.cc
index 9ed3d02..de6a509 100644
--- a/webrtc/video_engine/vie_capturer_unittest.cc
+++ b/webrtc/video_engine/vie_capturer_unittest.cc
@@ -274,11 +274,10 @@
   const int width = 36;
   const int height = 24;
   const int kSizeY = width * height * 2;
-  const int kSizeUV = width * height;
   uint8_t buffer[kSizeY];
   memset(buffer, data, kSizeY);
   frame->CreateFrame(
-      kSizeY, buffer, kSizeUV, buffer, kSizeUV, buffer, width, height, width,
+      buffer, buffer, buffer, width, height, width,
       width / 2, width / 2);
   frame->set_timestamp(data);
   frame->set_ntp_time_ms(data);
diff --git a/webrtc/video_frame.h b/webrtc/video_frame.h
index 6ba2971..7911e25 100644
--- a/webrtc/video_frame.h
+++ b/webrtc/video_frame.h
@@ -46,12 +46,8 @@
   // CreateFrame: Sets the frame's members and buffers. If required size is
   // bigger than allocated one, new buffers of adequate size will be allocated.
   // Return value: 0 on success, -1 on error.
-  // TODO(magjed): Remove unnecessary buffer size arguments.
-  int CreateFrame(int size_y,
-                  const uint8_t* buffer_y,
-                  int size_u,
+  int CreateFrame(const uint8_t* buffer_y,
                   const uint8_t* buffer_u,
-                  int size_v,
                   const uint8_t* buffer_v,
                   int width,
                   int height,
@@ -60,11 +56,8 @@
                   int stride_v);
 
   // TODO(guoweis): remove the previous CreateFrame when chromium has this code.
-  int CreateFrame(int size_y,
-                  const uint8_t* buffer_y,
-                  int size_u,
+  int CreateFrame(const uint8_t* buffer_y,
                   const uint8_t* buffer_u,
-                  int size_v,
                   const uint8_t* buffer_v,
                   int width,
                   int height,