Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Unified Diff: media/base/android/java/src/org/chromium/media/VideoCaptureCamera2.java

Issue 975913003: [Android] Fix BufferUnderflowException in webrtc buffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/android/java/src/org/chromium/media/VideoCaptureCamera2.java
diff --git a/media/base/android/java/src/org/chromium/media/VideoCaptureCamera2.java b/media/base/android/java/src/org/chromium/media/VideoCaptureCamera2.java
index 802792b63f36f09672bace0980427d9c22db4a84..2fe557b051700d1049336d2fb801b29baee49d4c 100644
--- a/media/base/android/java/src/org/chromium/media/VideoCaptureCamera2.java
+++ b/media/base/android/java/src/org/chromium/media/VideoCaptureCamera2.java
@@ -264,12 +264,19 @@ public class VideoCaptureCamera2 extends VideoCapture {
} else {
// Copy pixels one by one respecting pixelStride and rowStride.
byte[] rowData = new byte[rowStride];
- for (int row = 0; row < planeHeight; ++row) {
+ for (int row = 0; row < planeHeight - 1; ++row) {
buffer.get(rowData, 0, rowStride);
for (int col = 0; col < planeWidth; ++col) {
data[offset++] = rowData[col * pixelStride];
}
}
+
+ // Last row is special in some devices and may not contain the full
+ // |rowStride| bytes of data. See http://crbug.com/458701.
+ buffer.get(rowData, 0, Math.min(rowStride, buffer.remaining()));
+ for (int col = 0; col < planeWidth; ++col) {
+ data[offset++] = rowData[col * pixelStride];
+ }
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698