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