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

Fix attempt for #2438

This commit is contained in:
tux3 2015-12-04 20:35:50 +01:00
parent 7f5f807bde
commit b1f8d3f912
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -50,6 +50,7 @@ CameraDevice* CameraDevice::open(QString devName, AVDictionary** options)
openDeviceLock.lock();
AVFormatContext* fctx = nullptr;
CameraDevice* dev = openDevices.value(devName);
int aduration;
if (dev)
goto out;
@ -72,12 +73,25 @@ CameraDevice* CameraDevice::open(QString devName, AVDictionary** options)
if (avformat_open_input(&fctx, devName.toStdString().c_str(), format, options)<0)
goto out;
// Fix avformat_find_stream_info hanging on garbage input
#if FF_API_PROBESIZE_32
aduration = fctx->max_analyze_duration2 = 0;
#else
aduration = fctx->max_analyze_duration = 0;
#endif
if (avformat_find_stream_info(fctx, NULL) < 0)
{
avformat_close_input(&fctx);
goto out;
}
#if FF_API_PROBESIZE_32
fctx->max_analyze_duration2 = aduration;
#else
fctx->max_analyze_duration = aduration;
#endif
dev = new CameraDevice{devName, fctx};
openDevices[devName] = dev;