Re-create texture image on format change.

This commit is contained in:
John Preston 2022-03-30 17:07:35 +04:00
parent 5167eb47ae
commit 2aa293f1a5
4 changed files with 8 additions and 2 deletions

View file

@ -212,6 +212,7 @@ void OverlayWidget::RendererGL::paintTransformedVideoFrame(
program->bind();
const auto nv12 = (data.format == Streaming::FrameFormat::NV12);
const auto yuv = data.yuv;
const auto nv12changed = (_chromaNV12 != nv12);
const auto upload = (_trackFrameIndex != data.index)
|| (_streamedIndex != _owner->streamedIndex());
@ -238,13 +239,14 @@ void OverlayWidget::RendererGL::paintTransformedVideoFrame(
nv12 ? GL_RG : GL_ALPHA,
nv12 ? GL_RG : GL_ALPHA,
yuv->chromaSize,
_chromaSize,
nv12changed ? QSize() : _chromaSize,
yuv->u.stride / (nv12 ? 2 : 1),
yuv->u.data);
if (nv12) {
_chromaSize = yuv->chromaSize;
_f->glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
}
_chromaNV12 = nv12;
}
if (!nv12) {
_f->glActiveTexture(GL_TEXTURE2);

View file

@ -117,6 +117,7 @@ private:
qint64 _cacheKey = 0;
int _trackFrameIndex = 0;
int _streamedIndex = 0;
bool _chromaNV12 = false;
Ui::GL::Image _radialImage;
Ui::GL::Image _documentBubbleImage;

View file

@ -307,6 +307,7 @@ void Pip::RendererGL::paintTransformedVideoFrame(
program->bind();
const auto nv12 = (data.format == Streaming::FrameFormat::NV12);
const auto yuv = data.yuv;
const auto nv12changed = (_chromaNV12 != nv12);
const auto upload = (_trackFrameIndex != data.index);
_trackFrameIndex = data.index;
@ -331,13 +332,14 @@ void Pip::RendererGL::paintTransformedVideoFrame(
nv12 ? GL_RG : GL_ALPHA,
nv12 ? GL_RG : GL_ALPHA,
yuv->chromaSize,
_chromaSize,
nv12changed ? QSize() : _chromaSize,
yuv->u.stride / (nv12 ? 2 : 1),
yuv->u.data);
if (nv12) {
_chromaSize = yuv->chromaSize;
_f->glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
}
_chromaNV12 = nv12;
}
if (!nv12) {
_f->glActiveTexture(GL_TEXTURE2);

View file

@ -108,6 +108,7 @@ private:
QSize _chromaSize;
quint64 _cacheKey = 0;
int _trackFrameIndex = 0;
bool _chromaNV12 = false;
Ui::GL::Image _radialImage;
Ui::GL::Image _controlsImage;