Skip to content

Commit 8b31a5e

Browse files
authored
fix: eliminate video playback flicker during resolution changes (#2306)
https://developer.android.com/reference/android/graphics/SurfaceTexture#setDefaultBufferSize(int,%20int) > For OpenGL ES, the EGLSurface should be destroyed (via eglDestroySurface), made not-current (via eglMakeCurrent), and then recreated (via eglCreateWindowSurface) to ensure that the new default size has taken effect. https://blog.csdn.net/wzw88486969/article/details/138485679
1 parent 5ae632b commit 8b31a5e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

android/src/main/cpp/iris_rtc_rendering_android.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,6 @@ class NativeTextureRenderer final
701701
env->DeleteLocalRef(j_caller_class);
702702

703703
native_windows_ = ANativeWindow_fromSurface(env, surface_jni);
704-
gl_context_ = std::make_shared<GLContext>(native_windows_);
705704

706705
IrisRtcVideoFrameConfig config;
707706
config.uid = uid;
@@ -739,6 +738,13 @@ class NativeTextureRenderer final
739738
NotifySizeChangeCallback(video_frame->width, video_frame->height);
740739
width_ = video_frame->width;
741740
height_ = video_frame->height;
741+
742+
rendering_op_.reset();
743+
gl_context_.reset();
744+
}
745+
746+
if (!gl_context_) {
747+
gl_context_ = std::make_shared<GLContext>(native_windows_);
742748
}
743749

744750
if (!gl_context_->SetupSurface(native_windows_)) {

0 commit comments

Comments
 (0)