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

Unified Diff: webrtc/api/android/jni/androidmediadecoder_jni.cc

Issue 2278883002: Move MutableDataY{,U,V} methods to I420Buffer only. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 4 years, 3 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 | webrtc/api/androidvideotracksource.cc » ('j') | webrtc/common_video/video_frame.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/android/jni/androidmediadecoder_jni.cc
diff --git a/webrtc/api/android/jni/androidmediadecoder_jni.cc b/webrtc/api/android/jni/androidmediadecoder_jni.cc
index 2a7e68976aff881386d4ab363cebf30311080782..96c0fc2f7cbae92130f69d6313d3acdf93e84f3e 100644
--- a/webrtc/api/android/jni/androidmediadecoder_jni.cc
+++ b/webrtc/api/android/jni/androidmediadecoder_jni.cc
@@ -782,7 +782,9 @@ bool MediaCodecVideoDecoder::DeliverPendingOutputs(
payload += output_buffer_offset;
// Create yuv420 frame.
- frame_buffer = decoded_frame_pool_.CreateBuffer(width, height);
+ rtc::scoped_refptr<webrtc::I420Buffer> i420_buffer;
+
+ 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);
@@ -791,31 +793,23 @@ bool MediaCodecVideoDecoder::DeliverPendingOutputs(
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;
- libyuv::I420Copy(y_ptr, stride,
- u_ptr, uv_stride,
- v_ptr, uv_stride,
- frame_buffer->MutableDataY(),
- frame_buffer->StrideY(),
- frame_buffer->MutableDataU(),
- frame_buffer->StrideU(),
- frame_buffer->MutableDataV(),
- frame_buffer->StrideV(),
+ libyuv::I420Copy(y_ptr, stride, u_ptr, uv_stride, v_ptr, uv_stride,
+ i420_buffer->MutableDataY(), i420_buffer->StrideY(),
+ i420_buffer->MutableDataU(), i420_buffer->StrideU(),
+ i420_buffer->MutableDataV(), i420_buffer->StrideV(),
width, height);
} else {
// All other supported formats are nv12.
const uint8_t* y_ptr = payload;
const uint8_t* uv_ptr = y_ptr + stride * slice_height;
- libyuv::NV12ToI420(
- y_ptr, stride,
- uv_ptr, stride,
- frame_buffer->MutableDataY(),
- frame_buffer->StrideY(),
- frame_buffer->MutableDataU(),
- frame_buffer->StrideU(),
- frame_buffer->MutableDataV(),
- frame_buffer->StrideV(),
- width, height);
+ libyuv::NV12ToI420(y_ptr, stride, uv_ptr, stride,
+ i420_buffer->MutableDataY(), i420_buffer->StrideY(),
+ i420_buffer->MutableDataU(), i420_buffer->StrideU(),
+ i420_buffer->MutableDataV(), i420_buffer->StrideV(),
+ width, height);
}
+ frame_buffer = i420_buffer;
+
// Return output byte buffer back to codec.
jni->CallVoidMethod(
*j_media_codec_video_decoder_,
« no previous file with comments | « no previous file | webrtc/api/androidvideotracksource.cc » ('j') | webrtc/common_video/video_frame.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698