Add checks for buffer size in MediaCodecVideoEncoder.

This should help users of the library to more easily debug issues.

Bug: None
Change-Id: I85d8101d3b26ccbc34c8beded069461252e61293
Reviewed-on: https://webrtc-review.googlesource.com/4663
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20073}
diff --git a/sdk/android/api/org/webrtc/VideoFrame.java b/sdk/android/api/org/webrtc/VideoFrame.java
index a131121..6ff5412 100644
--- a/sdk/android/api/org/webrtc/VideoFrame.java
+++ b/sdk/android/api/org/webrtc/VideoFrame.java
@@ -58,21 +58,24 @@
    */
   public interface I420Buffer extends Buffer {
     /**
-     * Returns a direct ByteBuffer containing Y-plane data. The buffer size is at least getStrideY()
-     * * getHeight() bytes. Callers may mutate the ByteBuffer (eg. through relative-read
-     * operations), so implementations must return a new ByteBuffer or slice for each call.
+     * Returns a direct ByteBuffer containing Y-plane data. The buffer capacity is at least
+     * getStrideY() * getHeight() bytes. The position of the returned buffer is ignored and must
+     * be 0. Callers may mutate the ByteBuffer (eg. through relative-read operations), so
+     * implementations must return a new ByteBuffer or slice for each call.
      */
     ByteBuffer getDataY();
     /**
-     * Returns a direct ByteBuffer containing U-plane data. The buffer size is at least getStrideU()
-     * * ((getHeight() + 1) / 2) bytes. Callers may mutate the ByteBuffer (eg. through relative-read
-     * operations), so implementations must return a new ByteBuffer or slice for each call.
+     * Returns a direct ByteBuffer containing U-plane data. The buffer capacity is at least
+     * getStrideU() * ((getHeight() + 1) / 2) bytes. The position of the returned buffer is ignored
+     * and must be 0. Callers may mutate the ByteBuffer (eg. through relative-read operations), so
+     * implementations must return a new ByteBuffer or slice for each call.
      */
     ByteBuffer getDataU();
     /**
-     * Returns a direct ByteBuffer containing V-plane data. The buffer size is at least getStrideV()
-     * * ((getHeight() + 1) / 2) bytes. Callers may mutate the ByteBuffer (eg. through relative-read
-     * operations), so implementations must return a new ByteBuffer or slice for each call.
+     * Returns a direct ByteBuffer containing V-plane data. The buffer capacity is at least
+     * getStrideV() * ((getHeight() + 1) / 2) bytes. The position of the returned buffer is ignored
+     * and must be 0. Callers may mutate the ByteBuffer (eg. through relative-read operations), so
+     * implementations must return a new ByteBuffer or slice for each call.
      */
     ByteBuffer getDataV();