mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Limit desktop streamins FPS
Otherwise we get overwhelmed and start dropping frames
This commit is contained in:
parent
9e65cfde5c
commit
e3dd2dc9e1
|
@ -83,7 +83,7 @@ CameraDevice* CameraDevice::open(QString devName, VideoMode mode)
|
|||
else if (devName.startsWith("x11grab#"))
|
||||
{
|
||||
QSize screen;
|
||||
if (mode)
|
||||
if (mode.width && mode.height)
|
||||
{
|
||||
screen.setWidth(mode.width);
|
||||
screen.setHeight(mode.height);
|
||||
|
@ -96,6 +96,16 @@ CameraDevice* CameraDevice::open(QString devName, VideoMode mode)
|
|||
screen.setHeight(screen.height()-1);
|
||||
}
|
||||
av_dict_set(&options, "video_size", QString("%1x%2").arg(screen.width()).arg(screen.height()).toStdString().c_str(), 0);
|
||||
if (mode.FPS)
|
||||
av_dict_set(&options, "framerate", QString().setNum(mode.FPS).toStdString().c_str(), 0);
|
||||
else
|
||||
av_dict_set(&options, "framerate", QString().setNum(5).toStdString().c_str(), 0);
|
||||
}
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
else if (devName.startsWith("gdigrab#"))
|
||||
{
|
||||
av_dict_set(&options, "framerate", QString().setNum(5).toStdString().c_str(), 0);
|
||||
}
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
|
|
|
@ -128,7 +128,13 @@ void AVForm::updateVideoModes(int curIndex)
|
|||
VideoMode mode = videoModes[i];
|
||||
if (mode.width==prefRes.width() && mode.height==prefRes.height() && prefResIndex==-1)
|
||||
prefResIndex = i;
|
||||
QString str = tr("%1x%2 at %3 FPS").arg(mode.width).arg(mode.height).arg(mode.FPS);
|
||||
QString str;
|
||||
if (mode.height && mode.width)
|
||||
str += tr("%1x%2").arg(mode.width).arg(mode.height);
|
||||
else
|
||||
str += tr("Default resolution");
|
||||
if (mode.FPS)
|
||||
str += tr(" at %1 FPS").arg(mode.FPS);
|
||||
bodyUI->videoModescomboBox->addItem(str);
|
||||
}
|
||||
if (videoModes.isEmpty())
|
||||
|
|
Loading…
Reference in New Issue
Block a user