mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-15 07:44:10 +00:00
linux-v4l2: Fix fallback framerate for camera
This commit is contained in:
parent
c9dd230a72
commit
23ce4fe2f1
|
@ -39,6 +39,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "v4l2-helpers.h"
|
||||
#include "v4l2-decoder.h"
|
||||
|
||||
#define FALLBACK_FRAMERATE 30
|
||||
|
||||
#if HAVE_UDEV
|
||||
#include "v4l2-udev.h"
|
||||
#endif
|
||||
|
@ -1029,6 +1031,11 @@ static void v4l2_init(struct v4l2_data *data)
|
|||
blog(LOG_ERROR, "Unable to set framerate");
|
||||
goto fail;
|
||||
}
|
||||
if (data->framerate == 0) {
|
||||
blog(LOG_ERROR, "Framerate is not set, falling back to %i",
|
||||
FALLBACK_FRAMERATE);
|
||||
data->framerate = v4l2_pack_tuple(1, FALLBACK_FRAMERATE);
|
||||
}
|
||||
v4l2_unpack_tuple(&fps_num, &fps_denom, data->framerate);
|
||||
blog(LOG_INFO, "Framerate: %.2f fps", (float)fps_denom / fps_num);
|
||||
|
||||
|
|
Loading…
Reference in a new issue