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

fix(video): don't pass invalid pixel format strings to ffmpeg

This commit is contained in:
sudden6 2018-09-28 21:35:38 +02:00
parent 3746bd13bc
commit 9de40e5a97
No known key found for this signature in database
GPG Key ID: 279509B499E032B9

View File

@ -191,8 +191,9 @@ CameraDevice* CameraDevice::open(QString devName, VideoMode mode)
av_dict_set(&options, "video_size", videoSize.c_str(), 0);
av_dict_set(&options, "framerate", framerate.c_str(), 0);
const std::string pixelFormatStr = v4l2::getPixelFormatString(mode.pixel_format).toStdString();
// don't try to set a format string that doesn't exist
if (pixelFormatStr != "unknown" && pixelFormatStr != "invalid") {
const char* pixel_format = pixelFormatStr.c_str();
if (strncmp(pixel_format, "unknown", 7) != 0) {
av_dict_set(&options, "pixel_format", pixel_format, 0);
}
}