Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(590)

Side by Side Diff: webrtc/api/androidvideotracksource.cc

Issue 2471783002: Revert of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/api/android/jni/peerconnection_jni.cc ('k') | webrtc/api/mediastreaminterface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « webrtc/api/android/jni/peerconnection_jni.cc ('k') | webrtc/api/mediastreaminterface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698