OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 uv_plane, uv_width * 2, | 90 uv_plane, uv_width * 2, |
91 crop_width, crop_height, | 91 crop_width, crop_height, |
92 buffer->MutableDataY(), buffer->StrideY(), | 92 buffer->MutableDataY(), buffer->StrideY(), |
93 // Swap U and V, since we have NV21, not NV12. | 93 // Swap U and V, since we have NV21, not NV12. |
94 buffer->MutableDataV(), buffer->StrideV(), | 94 buffer->MutableDataV(), buffer->StrideV(), |
95 buffer->MutableDataU(), buffer->StrideU(), | 95 buffer->MutableDataU(), buffer->StrideU(), |
96 buffer->width(), buffer->height()); | 96 buffer->width(), buffer->height()); |
97 | 97 |
98 OnFrame(cricket::WebRtcVideoFrame( | 98 OnFrame(cricket::WebRtcVideoFrame( |
99 buffer, static_cast<webrtc::VideoRotation>(rotation), | 99 buffer, static_cast<webrtc::VideoRotation>(rotation), |
100 translated_camera_time_us, 0)); | 100 translated_camera_time_us)); |
101 } | 101 } |
102 | 102 |
103 void AndroidVideoTrackSource::OnTextureFrameCaptured( | 103 void AndroidVideoTrackSource::OnTextureFrameCaptured( |
104 int width, | 104 int width, |
105 int height, | 105 int height, |
106 int rotation, | 106 int rotation, |
107 int64_t timestamp_ns, | 107 int64_t timestamp_ns, |
108 const webrtc_jni::NativeHandleImpl& handle) { | 108 const webrtc_jni::NativeHandleImpl& handle) { |
109 RTC_DCHECK(camera_thread_checker_.CalledOnValidThread()); | 109 RTC_DCHECK(camera_thread_checker_.CalledOnValidThread()); |
110 RTC_DCHECK(rotation == 0 || rotation == 90 || rotation == 180 || | 110 RTC_DCHECK(rotation == 0 || rotation == 90 || rotation == 180 || |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 } | 146 } |
147 matrix.Rotate(static_cast<webrtc::VideoRotation>(rotation)); | 147 matrix.Rotate(static_cast<webrtc::VideoRotation>(rotation)); |
148 } | 148 } |
149 | 149 |
150 OnFrame(cricket::WebRtcVideoFrame( | 150 OnFrame(cricket::WebRtcVideoFrame( |
151 surface_texture_helper_->CreateTextureFrame( | 151 surface_texture_helper_->CreateTextureFrame( |
152 adapted_width, adapted_height, | 152 adapted_width, adapted_height, |
153 webrtc_jni::NativeHandleImpl(handle.oes_texture_id, matrix)), | 153 webrtc_jni::NativeHandleImpl(handle.oes_texture_id, matrix)), |
154 do_rotate ? webrtc::kVideoRotation_0 | 154 do_rotate ? webrtc::kVideoRotation_0 |
155 : static_cast<webrtc::VideoRotation>(rotation), | 155 : static_cast<webrtc::VideoRotation>(rotation), |
156 translated_camera_time_us, 0)); | 156 translated_camera_time_us)); |
157 } | 157 } |
158 | 158 |
159 void AndroidVideoTrackSource::OnOutputFormatRequest(int width, | 159 void AndroidVideoTrackSource::OnOutputFormatRequest(int width, |
160 int height, | 160 int height, |
161 int fps) { | 161 int fps) { |
162 cricket::VideoFormat format(width, height, | 162 cricket::VideoFormat format(width, height, |
163 cricket::VideoFormat::FpsToInterval(fps), 0); | 163 cricket::VideoFormat::FpsToInterval(fps), 0); |
164 video_adapter()->OnOutputFormatRequest(format); | 164 video_adapter()->OnOutputFormatRequest(format); |
165 } | 165 } |
166 | 166 |
167 } // namespace webrtc | 167 } // namespace webrtc |
OLD | NEW |