diff options
author | Vincent Dehors <vincent.dehors@openwide.fr> | 2018-05-04 15:08:47 +0300 |
---|---|---|
committer | George Kiagiadakis <george.kiagiadakis@collabora.com> | 2018-05-04 15:08:47 +0300 |
commit | 49a030719452f44042d008b2018af246d120fb07 (patch) | |
tree | 74ac1d76c3f7da5b5813077bd599af8acef4e388 | |
parent | 088acb70e969f8ece8986cf2ab0c2f4ac1379f48 (diff) |
videomaterial.cpp: Prevent the use of uninitialized textures for RGB formats
https://bugzilla.gnome.org/show_bug.cgi?id=751770
-rw-r--r-- | elements/gstqtvideosink/painters/videomaterial.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/elements/gstqtvideosink/painters/videomaterial.cpp b/elements/gstqtvideosink/painters/videomaterial.cpp index 49a2f47..7221aa5 100644 --- a/elements/gstqtvideosink/painters/videomaterial.cpp +++ b/elements/gstqtvideosink/painters/videomaterial.cpp @@ -414,19 +414,27 @@ void VideoMaterial::bind() if (frame) { GstMapInfo info; gst_buffer_map(frame, &info, GST_MAP_READ); - functions->glActiveTexture(GL_TEXTURE1); - bindTexture(1, info.data); - functions->glActiveTexture(GL_TEXTURE2); - bindTexture(2, info.data); + if (m_textureCount > 1) { + functions->glActiveTexture(GL_TEXTURE1); + bindTexture(1, info.data); + } + if (m_textureCount > 2) { + functions->glActiveTexture(GL_TEXTURE2); + bindTexture(2, info.data); + } functions->glActiveTexture(GL_TEXTURE0); // Finish with 0 as default texture unit bindTexture(0, info.data); gst_buffer_unmap(frame, &info); gst_buffer_unref(frame); } else { - functions->glActiveTexture(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D, m_textureIds[1]); - functions->glActiveTexture(GL_TEXTURE2); - glBindTexture(GL_TEXTURE_2D, m_textureIds[2]); + if (m_textureCount > 1) { + functions->glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D, m_textureIds[1]); + } + if (m_textureCount > 2) { + functions->glActiveTexture(GL_TEXTURE2); + glBindTexture(GL_TEXTURE_2D, m_textureIds[2]); + } functions->glActiveTexture(GL_TEXTURE0); // Finish with 0 as default texture unit glBindTexture(GL_TEXTURE_2D, m_textureIds[0]); } |