OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 | 174 |
175 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer = | 175 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer = |
176 buffer_pool_.CreateBuffer(width, height); | 176 buffer_pool_.CreateBuffer(width, height); |
177 libyuv::NV21ToI420( | 177 libyuv::NV21ToI420( |
178 y_plane, width, | 178 y_plane, width, |
179 vu_plane, width, | 179 vu_plane, width, |
180 buffer->MutableData(webrtc::kYPlane), buffer->stride(webrtc::kYPlane), | 180 buffer->MutableData(webrtc::kYPlane), buffer->stride(webrtc::kYPlane), |
181 buffer->MutableData(webrtc::kUPlane), buffer->stride(webrtc::kUPlane), | 181 buffer->MutableData(webrtc::kUPlane), buffer->stride(webrtc::kUPlane), |
182 buffer->MutableData(webrtc::kVPlane), buffer->stride(webrtc::kVPlane), | 182 buffer->MutableData(webrtc::kVPlane), buffer->stride(webrtc::kVPlane), |
183 width, height); | 183 width, height); |
184 AsyncCapturerInvoke("OnIncomingFrame", | 184 |
185 &webrtc::AndroidVideoCapturer::OnIncomingFrame, | 185 rtc::CritScope cs(&capturer_lock_); |
186 buffer, rotation, timestamp_ns); | 186 capturer_->OnIncomingFrame(buffer, rotation, timestamp_ns); |
187 } | 187 } |
188 | 188 |
189 void AndroidVideoCapturerJni::OnTextureFrame(int width, | 189 void AndroidVideoCapturerJni::OnTextureFrame(int width, |
190 int height, | 190 int height, |
191 int rotation, | 191 int rotation, |
192 int64_t timestamp_ns, | 192 int64_t timestamp_ns, |
193 const NativeHandleImpl& handle) { | 193 const NativeHandleImpl& handle) { |
194 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer( | 194 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer( |
195 surface_texture_helper_->CreateTextureFrame(width, height, handle)); | 195 surface_texture_helper_->CreateTextureFrame(width, height, handle)); |
196 | 196 |
197 AsyncCapturerInvoke("OnIncomingFrame", | 197 rtc::CritScope cs(&capturer_lock_); |
pbos-webrtc
2016/05/17 14:26:06
Any risk of this deadlocking?
nisse-webrtc
2016/05/18 07:44:01
No idea... The capturer_ pointer is declared with
nisse-webrtc
2016/05/18 12:28:03
It seems capturer_lock_ was introduced in cl https
magjed_webrtc
2016/05/18 15:12:50
It was/is used to protect against callbacks from t
nisse-webrtc
2016/05/18 15:31:31
Don't we need something like
rtc::CritScope cs(
magjed_webrtc
2016/05/18 15:51:28
We have exactly such a check in AsyncCapturerInvok
nisse-webrtc
2016/05/19 07:01:04
Done.
| |
198 &webrtc::AndroidVideoCapturer::OnIncomingFrame, | 198 capturer_->OnIncomingFrame(buffer, rotation, timestamp_ns); |
199 buffer, rotation, timestamp_ns); | |
200 } | 199 } |
201 | 200 |
202 void AndroidVideoCapturerJni::OnOutputFormatRequest(int width, | 201 void AndroidVideoCapturerJni::OnOutputFormatRequest(int width, |
203 int height, | 202 int height, |
204 int fps) { | 203 int fps) { |
205 AsyncCapturerInvoke("OnOutputFormatRequest", | 204 AsyncCapturerInvoke("OnOutputFormatRequest", |
206 &webrtc::AndroidVideoCapturer::OnOutputFormatRequest, | 205 &webrtc::AndroidVideoCapturer::OnOutputFormatRequest, |
207 width, height, fps); | 206 width, height, fps); |
208 } | 207 } |
209 | 208 |
(...skipping 29 matching lines...) Expand all Loading... | |
239 | 238 |
240 JOW(void, VideoCapturer_00024NativeObserver_nativeOnOutputFormatRequest) | 239 JOW(void, VideoCapturer_00024NativeObserver_nativeOnOutputFormatRequest) |
241 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height, | 240 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height, |
242 jint j_fps) { | 241 jint j_fps) { |
243 LOG(LS_INFO) << "NativeObserver_nativeOnOutputFormatRequest"; | 242 LOG(LS_INFO) << "NativeObserver_nativeOnOutputFormatRequest"; |
244 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnOutputFormatRequest( | 243 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnOutputFormatRequest( |
245 j_width, j_height, j_fps); | 244 j_width, j_height, j_fps); |
246 } | 245 } |
247 | 246 |
248 } // namespace webrtc_jni | 247 } // namespace webrtc_jni |
OLD | NEW |