Skip to content
Snippets Groups Projects
Commit 306c536b authored by Adrien Béraud's avatar Adrien Béraud
Browse files

accel: don't transfer frames with invalid format

Change-Id: I81b8d9988aaa79d6e67142417e9f004689d69ab9
parent beac042f
No related branches found
No related tags found
No related merge requests found
......@@ -376,10 +376,14 @@ HardwareAccel::transferToMainMemory(const VideoFrame& frame, AVPixelFormat desir
auto input = frame.pointer();
if (not input)
throw std::runtime_error("Cannot transfer null frame");
auto out = std::make_unique<VideoFrame>();
auto desc = av_pix_fmt_desc_get(static_cast<AVPixelFormat>(input->format));
if (desc && not(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
if (!desc) {
throw std::runtime_error("Cannot transfer frame with invalid format");
}
auto out = std::make_unique<VideoFrame>();
if (not(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
out->copyFrom(frame);
return out;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment