Revert of Delete cricket::VideoFrame methods GetYPlane and GetYPitch. (patchset #5 id:80001 of https://codereview.webrtc.org/1901973002/ )
Reason for revert:
GetYPlane, GetYPitch etc is used by Chromium.
Original issue's description:
> Delete cricket::VideoFrame methods GetYPlane and GetYPitch.
>
> (And similarly for U and V). Also change video_frame_buffer method to
> return a const ref to a scoped_ref_ptr.
>
> This cl is analogous to https://codereview.webrtc.org/1900673002/,
> which delete corresponding methods in webrtc::VideoFrame.
>
> BUG=webrtc:5682
>
> Committed: https://crrev.com/1c27c6bf4cf0476dd2f09425509afaae4cdfe599
> Cr-Commit-Position: refs/heads/master@{#12492}
TBR=magjed@webrtc.org,perkj@webrtc.org,pbos@webrtc.org,pthatcher@webrtc.org,nisse@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5682
Review URL: https://codereview.webrtc.org/1921493004
Cr-Commit-Position: refs/heads/master@{#12494}
diff --git a/webrtc/api/java/jni/peerconnection_jni.cc b/webrtc/api/java/jni/peerconnection_jni.cc
index 38d2ff3..fdd2d44 100644
--- a/webrtc/api/java/jni/peerconnection_jni.cc
+++ b/webrtc/api/java/jni/peerconnection_jni.cc
@@ -763,23 +763,20 @@
jobject CricketToJavaI420Frame(const cricket::VideoFrame* frame) {
jintArray strides = jni()->NewIntArray(3);
jint* strides_array = jni()->GetIntArrayElements(strides, NULL);
- strides_array[0] = frame->video_frame_buffer()->StrideY();
- strides_array[1] = frame->video_frame_buffer()->StrideU();
- strides_array[2] = frame->video_frame_buffer()->StrideV();
+ strides_array[0] = frame->GetYPitch();
+ strides_array[1] = frame->GetUPitch();
+ strides_array[2] = frame->GetVPitch();
jni()->ReleaseIntArrayElements(strides, strides_array, 0);
jobjectArray planes = jni()->NewObjectArray(3, *j_byte_buffer_class_, NULL);
- jobject y_buffer = jni()->NewDirectByteBuffer(
- const_cast<uint8_t*>(frame->video_frame_buffer()->DataY()),
- frame->video_frame_buffer()->StrideY() *
- frame->video_frame_buffer()->height());
+ jobject y_buffer =
+ jni()->NewDirectByteBuffer(const_cast<uint8_t*>(frame->GetYPlane()),
+ frame->GetYPitch() * frame->GetHeight());
size_t chroma_size =
((frame->width() + 1) / 2) * ((frame->height() + 1) / 2);
jobject u_buffer = jni()->NewDirectByteBuffer(
- const_cast<uint8_t*>(frame->video_frame_buffer()->DataU()),
- chroma_size);
+ const_cast<uint8_t*>(frame->GetUPlane()), chroma_size);
jobject v_buffer = jni()->NewDirectByteBuffer(
- const_cast<uint8_t*>(frame->video_frame_buffer()->DataV()),
- chroma_size);
+ const_cast<uint8_t*>(frame->GetVPlane()), chroma_size);
jni()->SetObjectArrayElement(planes, 0, y_buffer);
jni()->SetObjectArrayElement(planes, 1, u_buffer);
jni()->SetObjectArrayElement(planes, 2, v_buffer);