浏览代码

libobs: Copy both converted textures on stall for OpenGL

As the comment mentions this only occurs during an encoder stall on the
first frame. On D3D both gs_texture_t's are actually a single D3D
texture object and both planes are copied during gs_copy_texture, for
everyone else we need to copy the textures separately as they are
independent OpenGL textures.
Kurt Kartaltepe 1 年之前
父节点
当前提交
ccfcbc2699
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      libobs/obs-video.c

+ 7 - 0
libobs/obs-video.c

@@ -516,6 +516,13 @@ static inline bool queue_frame(struct obs_core_video_mix *video,
 	 * will ensure better performance. */
 	 * will ensure better performance. */
 	if (raw_active || vframe_info->count > 1) {
 	if (raw_active || vframe_info->count > 1) {
 		gs_copy_texture(tf.tex, video->convert_textures_encode[0]);
 		gs_copy_texture(tf.tex, video->convert_textures_encode[0]);
+#ifndef _WIN32
+		/* Y and UV textures are views of the same texture on D3D, and
+		 * gs_copy_texture will copy all views of the underlying
+		 * texture. On other platforms, these are two distinct textures
+		 * that must be copied separately. */
+		gs_copy_texture(tf.tex_uv, video->convert_textures_encode[1]);
+#endif
 	} else {
 	} else {
 		gs_texture_t *tex = video->convert_textures_encode[0];
 		gs_texture_t *tex = video->convert_textures_encode[0];
 		gs_texture_t *tex_uv = video->convert_textures_encode[1];
 		gs_texture_t *tex_uv = video->convert_textures_encode[1];