Fix crash when libvpx decoder is absent.

Fixes #26849.
This commit is contained in:
John Preston 2023-09-25 12:35:45 +04:00
parent 137fca73bd
commit 6f9a540a61
1 changed files with 6 additions and 1 deletions

View File

@ -254,7 +254,9 @@ FrameGenerator::Frame FrameGenerator::Impl::renderNext(
QImage storage,
QSize size,
Qt::AspectRatioMode mode) {
if (!_current.frame) {
if (!_codec) {
return {};
} else if (!_current.frame) {
readNextFrame();
}
std::swap(_current, _next);
@ -266,6 +268,9 @@ FrameGenerator::Frame FrameGenerator::Impl::renderNext(
}
void FrameGenerator::Impl::jumpToStart() {
if (!_codec) {
return;
}
auto result = 0;
if ((result = avformat_seek_file(_format.get(), _streamId, std::numeric_limits<int64_t>::min(), 0, std::numeric_limits<int64_t>::max(), 0)) < 0) {
if ((result = av_seek_frame(_format.get(), _streamId, 0, AVSEEK_FLAG_BYTE)) < 0) {