mirror of
https://github.com/stenzek/duckstation.git
synced 2025-07-29 06:11:47 +00:00
MediaCapture: Don't crash if video codec supports 0 formats
This commit is contained in:
parent
44237146ef
commit
2b18df0910
@ -2278,17 +2278,20 @@ bool MediaCaptureFFmpeg::InternalBeginCapture(float fps, float aspect, u32 sampl
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (!vcodec->pix_fmts)
|
supported_pixel_formats = vcodec->pix_fmts;
|
||||||
|
if (supported_pixel_formats)
|
||||||
|
{
|
||||||
|
while (supported_pixel_formats[num_supported_pixel_formats] != AV_PIX_FMT_NONE)
|
||||||
|
num_supported_pixel_formats++;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!supported_pixel_formats || num_supported_pixel_formats == 0)
|
||||||
{
|
{
|
||||||
Error::SetStringView(error, "Video codec supports no formats.");
|
Error::SetStringView(error, "Video codec supports no formats.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
supported_pixel_formats = vcodec->pix_fmts;
|
|
||||||
while (supported_pixel_formats[num_supported_pixel_formats] != AV_PIX_FMT_NONE)
|
|
||||||
num_supported_pixel_formats++;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Prefer YUV420 given the choice, but otherwise fall back to whatever it supports.
|
// Prefer YUV420 given the choice, but otherwise fall back to whatever it supports.
|
||||||
sw_pix_fmt = supported_pixel_formats[0];
|
sw_pix_fmt = supported_pixel_formats[0];
|
||||||
for (int i = 0; i < num_supported_pixel_formats; i++)
|
for (int i = 0; i < num_supported_pixel_formats; i++)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user