mirror of https://github.com/procxx/kepka.git
Check frame format before sws_getCachedContext.
This commit is contained in:
parent
e631d98230
commit
a8aa66d191
|
@ -137,6 +137,10 @@ SwsContextPointer MakeSwsContextPointer(
|
||||||
return std::move(*existing);
|
return std::move(*existing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (frame->format <= AV_PIX_FMT_NONE || frame->format >= AV_PIX_FMT_NB) {
|
||||||
|
LogError(qstr("frame->format"));
|
||||||
|
return SwsContextPointer();
|
||||||
|
}
|
||||||
|
|
||||||
const auto result = sws_getCachedContext(
|
const auto result = sws_getCachedContext(
|
||||||
existing ? existing->release() : nullptr,
|
existing ? existing->release() : nullptr,
|
||||||
|
@ -319,8 +323,7 @@ QImage ConvertFrame(
|
||||||
storage = CreateFrameStorage(resize);
|
storage = CreateFrameStorage(resize);
|
||||||
}
|
}
|
||||||
const auto format = AV_PIX_FMT_BGRA;
|
const auto format = AV_PIX_FMT_BGRA;
|
||||||
const auto hasDesiredFormat = (frame->format == format)
|
const auto hasDesiredFormat = (frame->format == format);
|
||||||
|| ((frame->format == -1) && (stream.codec->pix_fmt == format));
|
|
||||||
if (frameSize == storage.size() && hasDesiredFormat) {
|
if (frameSize == storage.size() && hasDesiredFormat) {
|
||||||
static_assert(sizeof(uint32) == kPixelBytesSize);
|
static_assert(sizeof(uint32) == kPixelBytesSize);
|
||||||
auto to = reinterpret_cast<uint32*>(storage.bits());
|
auto to = reinterpret_cast<uint32*>(storage.bits());
|
||||||
|
|
Loading…
Reference in New Issue