diff --git a/webrtc/api/java/jni/androidvideocapturer_jni.cc b/webrtc/api/java/jni/androidvideocapturer_jni.cc index 0e8e8677ab..bc85cc4146 100644 --- a/webrtc/api/java/jni/androidvideocapturer_jni.cc +++ b/webrtc/api/java/jni/androidvideocapturer_jni.cc @@ -264,6 +264,7 @@ void AndroidVideoCapturerJni::OnTextureFrame(int width, if (!capturer_->AdaptFrame(width, height, timestamp_ns, &adapted_width, &adapted_height, &crop_width, &crop_height, &crop_x, &crop_y)) { + surface_texture_helper_->ReturnTextureFrame(); return; } diff --git a/webrtc/api/java/jni/surfacetexturehelper_jni.h b/webrtc/api/java/jni/surfacetexturehelper_jni.h index d7a9a7707a..6bee728d31 100644 --- a/webrtc/api/java/jni/surfacetexturehelper_jni.h +++ b/webrtc/api/java/jni/surfacetexturehelper_jni.h @@ -49,14 +49,14 @@ class SurfaceTextureHelper : public rtc::RefCountInterface { int height, const NativeHandleImpl& native_handle); + // May be called on arbitrary thread. + void ReturnTextureFrame() const; + protected: ~SurfaceTextureHelper(); SurfaceTextureHelper(JNIEnv* jni, jobject j_surface_texture_helper); private: - // May be called on arbitrary thread. - void ReturnTextureFrame() const; - const ScopedGlobalRef j_surface_texture_helper_; const jmethodID j_return_texture_method_; };