OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 // Frame pointer in C++. | 38 // Frame pointer in C++. |
39 private long nativeFramePointer; | 39 private long nativeFramePointer; |
40 | 40 |
41 // rotationDegree is the degree that the frame must be rotated clockwisely | 41 // rotationDegree is the degree that the frame must be rotated clockwisely |
42 // to be rendered correctly. | 42 // to be rendered correctly. |
43 public int rotationDegree; | 43 public int rotationDegree; |
44 | 44 |
45 /** | 45 /** |
46 * Construct a frame of the given dimensions with the specified planar data. | 46 * Construct a frame of the given dimensions with the specified planar data. |
47 */ | 47 */ |
48 I420Frame(int width, int height, int rotationDegree, int[] yuvStrides, ByteB
uffer[] yuvPlanes, | 48 public I420Frame(int width, int height, int rotationDegree, int[] yuvStrides
, |
49 long nativeFramePointer) { | 49 ByteBuffer[] yuvPlanes, long nativeFramePointer) { |
50 this.width = width; | 50 this.width = width; |
51 this.height = height; | 51 this.height = height; |
52 this.yuvStrides = yuvStrides; | 52 this.yuvStrides = yuvStrides; |
53 this.yuvPlanes = yuvPlanes; | 53 this.yuvPlanes = yuvPlanes; |
54 this.yuvFrame = true; | 54 this.yuvFrame = true; |
55 this.rotationDegree = rotationDegree; | 55 this.rotationDegree = rotationDegree; |
56 this.nativeFramePointer = nativeFramePointer; | 56 this.nativeFramePointer = nativeFramePointer; |
57 if (rotationDegree % 90 != 0) { | 57 if (rotationDegree % 90 != 0) { |
58 throw new IllegalArgumentException("Rotation degree not multiple of 90:
" + rotationDegree); | 58 throw new IllegalArgumentException("Rotation degree not multiple of 90:
" + rotationDegree); |
59 } | 59 } |
60 // The convention in WebRTC is that the first element in a ByteBuffer corr
esponds to the | 60 // The convention in WebRTC is that the first element in a ByteBuffer corr
esponds to the |
61 // top-left corner of the image, but in glTexImage2D() the first element c
orresponds to the | 61 // top-left corner of the image, but in glTexImage2D() the first element c
orresponds to the |
62 // bottom-left corner. This discrepancy is corrected by setting a vertical
flip as sampling | 62 // bottom-left corner. This discrepancy is corrected by setting a vertical
flip as sampling |
63 // matrix. | 63 // matrix. |
64 // clang-format off | 64 // clang-format off |
65 samplingMatrix = new float[] { | 65 samplingMatrix = new float[] { |
66 1, 0, 0, 0, | 66 1, 0, 0, 0, |
67 0, -1, 0, 0, | 67 0, -1, 0, 0, |
68 0, 0, 1, 0, | 68 0, 0, 1, 0, |
69 0, 1, 0, 1}; | 69 0, 1, 0, 1}; |
70 // clang-format on | 70 // clang-format on |
71 } | 71 } |
72 | 72 |
73 /** | 73 /** |
74 * Construct a texture frame of the given dimensions with data in SurfaceTex
ture | 74 * Construct a texture frame of the given dimensions with data in SurfaceTex
ture |
75 */ | 75 */ |
76 I420Frame(int width, int height, int rotationDegree, int textureId, float[]
samplingMatrix, | 76 public I420Frame(int width, int height, int rotationDegree, int textureId, |
77 long nativeFramePointer) { | 77 float[] samplingMatrix, long nativeFramePointer) { |
78 this.width = width; | 78 this.width = width; |
79 this.height = height; | 79 this.height = height; |
80 this.yuvStrides = null; | 80 this.yuvStrides = null; |
81 this.yuvPlanes = null; | 81 this.yuvPlanes = null; |
82 this.samplingMatrix = samplingMatrix; | 82 this.samplingMatrix = samplingMatrix; |
83 this.textureId = textureId; | 83 this.textureId = textureId; |
84 this.yuvFrame = false; | 84 this.yuvFrame = false; |
85 this.rotationDegree = rotationDegree; | 85 this.rotationDegree = rotationDegree; |
86 this.nativeFramePointer = nativeFramePointer; | 86 this.nativeFramePointer = nativeFramePointer; |
87 if (rotationDegree % 90 != 0) { | 87 if (rotationDegree % 90 != 0) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 } | 141 } |
142 | 142 |
143 freeWrappedVideoRenderer(nativeVideoRenderer); | 143 freeWrappedVideoRenderer(nativeVideoRenderer); |
144 nativeVideoRenderer = 0; | 144 nativeVideoRenderer = 0; |
145 } | 145 } |
146 | 146 |
147 private static native long nativeWrapVideoRenderer(Callbacks callbacks); | 147 private static native long nativeWrapVideoRenderer(Callbacks callbacks); |
148 private static native void freeWrappedVideoRenderer(long nativeVideoRenderer); | 148 private static native void freeWrappedVideoRenderer(long nativeVideoRenderer); |
149 private static native void releaseNativeFrame(long nativeFramePointer); | 149 private static native void releaseNativeFrame(long nativeFramePointer); |
150 } | 150 } |
OLD | NEW |