1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00
This commit is contained in:
krepa098 2014-10-08 16:19:42 +02:00
parent 200b7bc395
commit 8ddb1329c9
3 changed files with 13 additions and 16 deletions

View File

@ -317,14 +317,15 @@ void SelfCamWorker::probeResolutions()
for (QSize res : propbeRes) for (QSize res : propbeRes)
{ {
_setProp(CV_CAP_PROP_FRAME_WIDTH, res.width()); cam.set(CV_CAP_PROP_FRAME_WIDTH, res.width());
_setProp(CV_CAP_PROP_FRAME_HEIGHT, res.height()); cam.set(CV_CAP_PROP_FRAME_HEIGHT, res.height());
double w = _getProp(CV_CAP_PROP_FRAME_WIDTH); double w = cam.get(CV_CAP_PROP_FRAME_WIDTH);
double h = _getProp(CV_CAP_PROP_FRAME_HEIGHT); double h = cam.get(CV_CAP_PROP_FRAME_HEIGHT);
qDebug() << "PROBING:" << res << " got " << w << h; //qDebug() << "PROBING:" << res << " got " << w << h;
if (!resolutions.contains(QSize(w,h)))
resolutions.append(QSize(w,h)); resolutions.append(QSize(w,h));
} }

View File

@ -29,7 +29,7 @@ SelfCamView::SelfCamView(VideoSource *Source, QWidget* parent)
, program(nullptr) , program(nullptr)
, textureId(0) , textureId(0)
, pboAllocSize(0) , pboAllocSize(0)
, useNewFrame(false) , uploadFrame(false)
, hasSubscribed(false) , hasSubscribed(false)
{ {
qDebug()<<"NEW VideoSurface:"<<source->resolution(); qDebug()<<"NEW VideoSurface:"<<source->resolution();
@ -78,8 +78,6 @@ void SelfCamView::initializeGL()
void SelfCamView::paintGL() void SelfCamView::paintGL()
{ {
//qDebug() << "PainterThread" << QThread::currentThreadId();
if (!pbo) if (!pbo)
{ {
qDebug() << "Creating pbo, program"; qDebug() << "Creating pbo, program";
@ -125,7 +123,7 @@ void SelfCamView::paintGL()
} }
if (useNewFrame) if (uploadFrame)
{ {
source->lock(); source->lock();
void* frame = source->getData(); void* frame = source->getData();
@ -158,6 +156,8 @@ void SelfCamView::paintGL()
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
pbo->release(); pbo->release();
uploadFrame = false;
} }
// render pbo // render pbo
@ -187,15 +187,11 @@ void SelfCamView::paintGL()
program->disableAttributeArray(0); program->disableAttributeArray(0);
program->release(); program->release();
//glFlush();
useNewFrame = false;
} }
void SelfCamView::updateGL() void SelfCamView::updateGL()
{ {
useNewFrame = true; uploadFrame = true;
QGLWidget::updateGL(); QGLWidget::updateGL();
} }

View File

@ -50,7 +50,7 @@ private:
GLuint textureId; GLuint textureId;
int pboAllocSize; int pboAllocSize;
QSize res; QSize res;
bool useNewFrame; bool uploadFrame;
bool hasSubscribed; bool hasSubscribed;
}; };