Index: webrtc/sdk/android/src/jni/androidmediadecoder_jni.cc |
diff --git a/webrtc/sdk/android/src/jni/androidmediadecoder_jni.cc b/webrtc/sdk/android/src/jni/androidmediadecoder_jni.cc |
index d999b01b0ac7684a957486e69949c934b0122559..7936b09f56866d868ba4d9564f99fa7e4dc39799 100644 |
--- a/webrtc/sdk/android/src/jni/androidmediadecoder_jni.cc |
+++ b/webrtc/sdk/android/src/jni/androidmediadecoder_jni.cc |
@@ -809,12 +809,14 @@ bool MediaCodecVideoDecoder::DeliverPendingOutputs( |
i420_buffer = decoded_frame_pool_.CreateBuffer(width, height); |
if (color_format == COLOR_FormatYUV420Planar) { |
RTC_CHECK_EQ(0, stride % 2); |
- RTC_CHECK_EQ(0, slice_height % 2); |
const int uv_stride = stride / 2; |
- const int u_slice_height = slice_height / 2; |
const uint8_t* y_ptr = payload; |
const uint8_t* u_ptr = y_ptr + stride * slice_height; |
- const uint8_t* v_ptr = u_ptr + uv_stride * u_slice_height; |
+ // This offset is weird when |slice_height| is not dividable by two, since |
+ // the last u row might not be full, but this is what's used in practice. |
+ // See http://bugs.webrtc.org/6651 for more info. |
+ const int u_offset = (uv_stride * slice_height + 1) / 2; |
+ const uint8_t* v_ptr = u_ptr + u_offset; |
libyuv::I420Copy(y_ptr, stride, u_ptr, uv_stride, v_ptr, uv_stride, |
sakal
2017/02/23 12:59:07
Hmm, it seems I420Copy is reading uv_stride * ((he
magjed_webrtc
2017/02/23 14:19:30
No. I made a new patch set that is more complicate
|
i420_buffer->MutableDataY(), i420_buffer->StrideY(), |
i420_buffer->MutableDataU(), i420_buffer->StrideU(), |