1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix(avform): add missing "first" video mode back to video modes

This commit fixes the fact that the selectBestModes() function strips
off the first video mode, often a 1080p or 720p mode.

Fixes #3588.
This commit is contained in:
initramfs 2016-08-05 01:15:08 +08:00
parent 0da1a2fd8b
commit 5324e768c3
No known key found for this signature in database
GPG Key ID: 78B8BDF87E9EF0AF

View File

@ -247,12 +247,22 @@ void AVForm::selectBestModes(QVector<VideoMode> &allVideoModes)
for (auto it = bestModeInds.rbegin(); it != bestModeInds.rend(); ++it)
{
VideoMode mode = allVideoModes[it->second];
int size = getModeSize(mode);
auto result = std::find_if(newVideoModes.cbegin(), newVideoModes.cend(),
[size](VideoMode mode) { return getModeSize(mode) == size; });
if (result == newVideoModes.end())
if(newVideoModes.empty())
{
newVideoModes.push_back(mode);
}
else
{
int size = getModeSize(mode);
auto result = std::find_if(newVideoModes.cbegin(), newVideoModes.cend(),
[size](VideoMode mode) { return getModeSize(mode) == size; });
if(result == newVideoModes.end())
{
newVideoModes.push_back(mode);
}
}
}
allVideoModes = newVideoModes;
}