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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 /** | 86 /** |
87 * Construct a frame from VideoFrame.Buffer. | 87 * Construct a frame from VideoFrame.Buffer. |
88 */ | 88 */ |
89 public I420Frame(int rotationDegree, VideoFrame.Buffer buffer, long nativeFr
amePointer) { | 89 public I420Frame(int rotationDegree, VideoFrame.Buffer buffer, long nativeFr
amePointer) { |
90 this.width = buffer.getWidth(); | 90 this.width = buffer.getWidth(); |
91 this.height = buffer.getHeight(); | 91 this.height = buffer.getHeight(); |
92 this.rotationDegree = rotationDegree; | 92 this.rotationDegree = rotationDegree; |
93 if (rotationDegree % 90 != 0) { | 93 if (rotationDegree % 90 != 0) { |
94 throw new IllegalArgumentException("Rotation degree not multiple of 90:
" + rotationDegree); | 94 throw new IllegalArgumentException("Rotation degree not multiple of 90:
" + rotationDegree); |
95 } | 95 } |
96 if (buffer instanceof VideoFrame.TextureBuffer) { | 96 if (buffer instanceof VideoFrame.TextureBuffer |
| 97 && ((VideoFrame.TextureBuffer) buffer).getType() == VideoFrame.Texture
Buffer.Type.OES) { |
97 VideoFrame.TextureBuffer textureBuffer = (VideoFrame.TextureBuffer) buff
er; | 98 VideoFrame.TextureBuffer textureBuffer = (VideoFrame.TextureBuffer) buff
er; |
98 this.yuvFrame = false; | 99 this.yuvFrame = false; |
99 this.textureId = textureBuffer.getTextureId(); | 100 this.textureId = textureBuffer.getTextureId(); |
100 this.samplingMatrix = RendererCommon.convertMatrixFromAndroidGraphicsMat
rix( | 101 this.samplingMatrix = RendererCommon.convertMatrixFromAndroidGraphicsMat
rix( |
101 textureBuffer.getTransformMatrix()); | 102 textureBuffer.getTransformMatrix()); |
102 | 103 |
103 this.yuvStrides = null; | 104 this.yuvStrides = null; |
104 this.yuvPlanes = null; | 105 this.yuvPlanes = null; |
105 } else { | 106 } else { |
106 VideoFrame.I420Buffer i420Buffer = buffer.toI420(); | 107 VideoFrame.I420Buffer i420Buffer = buffer.toI420(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 } | 192 } |
192 | 193 |
193 freeWrappedVideoRenderer(nativeVideoRenderer); | 194 freeWrappedVideoRenderer(nativeVideoRenderer); |
194 nativeVideoRenderer = 0; | 195 nativeVideoRenderer = 0; |
195 } | 196 } |
196 | 197 |
197 private static native long nativeWrapVideoRenderer(Callbacks callbacks); | 198 private static native long nativeWrapVideoRenderer(Callbacks callbacks); |
198 private static native void freeWrappedVideoRenderer(long nativeVideoRenderer); | 199 private static native void freeWrappedVideoRenderer(long nativeVideoRenderer); |
199 private static native void releaseNativeFrame(long nativeFramePointer); | 200 private static native void releaseNativeFrame(long nativeFramePointer); |
200 } | 201 } |
OLD | NEW |