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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 nv12toi420_scaler_.NV12ToI420Scale( | 88 nv12toi420_scaler_.NV12ToI420Scale( |
89 y_plane, width, | 89 y_plane, width, |
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(VideoFrame(buffer, static_cast<webrtc::VideoRotation>(rotation), | 98 OnFrame(cricket::WebRtcVideoFrame( |
99 translated_camera_time_us)); | 99 buffer, static_cast<webrtc::VideoRotation>(rotation), |
| 100 translated_camera_time_us)); |
100 } | 101 } |
101 | 102 |
102 void AndroidVideoTrackSource::OnTextureFrameCaptured( | 103 void AndroidVideoTrackSource::OnTextureFrameCaptured( |
103 int width, | 104 int width, |
104 int height, | 105 int height, |
105 int rotation, | 106 int rotation, |
106 int64_t timestamp_ns, | 107 int64_t timestamp_ns, |
107 const webrtc_jni::NativeHandleImpl& handle) { | 108 const webrtc_jni::NativeHandleImpl& handle) { |
108 RTC_DCHECK(camera_thread_checker_.CalledOnValidThread()); | 109 RTC_DCHECK(camera_thread_checker_.CalledOnValidThread()); |
109 RTC_DCHECK(rotation == 0 || rotation == 90 || rotation == 180 || | 110 RTC_DCHECK(rotation == 0 || rotation == 90 || rotation == 180 || |
(...skipping 29 matching lines...) Expand all Loading... |
139 bool do_rotate = apply_rotation(); | 140 bool do_rotate = apply_rotation(); |
140 | 141 |
141 if (do_rotate) { | 142 if (do_rotate) { |
142 if (rotation == webrtc::kVideoRotation_90 || | 143 if (rotation == webrtc::kVideoRotation_90 || |
143 rotation == webrtc::kVideoRotation_270) { | 144 rotation == webrtc::kVideoRotation_270) { |
144 std::swap(adapted_width, adapted_height); | 145 std::swap(adapted_width, adapted_height); |
145 } | 146 } |
146 matrix.Rotate(static_cast<webrtc::VideoRotation>(rotation)); | 147 matrix.Rotate(static_cast<webrtc::VideoRotation>(rotation)); |
147 } | 148 } |
148 | 149 |
149 OnFrame(VideoFrame( | 150 OnFrame(cricket::WebRtcVideoFrame( |
150 surface_texture_helper_->CreateTextureFrame( | 151 surface_texture_helper_->CreateTextureFrame( |
151 adapted_width, adapted_height, | 152 adapted_width, adapted_height, |
152 webrtc_jni::NativeHandleImpl(handle.oes_texture_id, matrix)), | 153 webrtc_jni::NativeHandleImpl(handle.oes_texture_id, matrix)), |
153 do_rotate ? webrtc::kVideoRotation_0 | 154 do_rotate ? webrtc::kVideoRotation_0 |
154 : static_cast<webrtc::VideoRotation>(rotation), | 155 : static_cast<webrtc::VideoRotation>(rotation), |
155 translated_camera_time_us)); | 156 translated_camera_time_us)); |
156 } | 157 } |
157 | 158 |
158 void AndroidVideoTrackSource::OnOutputFormatRequest(int width, | 159 void AndroidVideoTrackSource::OnOutputFormatRequest(int width, |
159 int height, | 160 int height, |
160 int fps) { | 161 int fps) { |
161 cricket::VideoFormat format(width, height, | 162 cricket::VideoFormat format(width, height, |
162 cricket::VideoFormat::FpsToInterval(fps), 0); | 163 cricket::VideoFormat::FpsToInterval(fps), 0); |
163 video_adapter()->OnOutputFormatRequest(format); | 164 video_adapter()->OnOutputFormatRequest(format); |
164 } | 165 } |
165 | 166 |
166 } // namespace webrtc | 167 } // namespace webrtc |
OLD | NEW |