cellRec: fix width of encoder frames

Turns out the pitch was accidentally used as width, leading to an out of bounds read/write.
I kept the pitch in the struct for completeness' sake. It may be needed later, if only for error checks.
This commit is contained in:
Megamouse 2023-08-12 23:06:22 +02:00
parent f40a6d496a
commit 39bbf17caf
12 changed files with 24 additions and 22 deletions

View file

@ -92,7 +92,7 @@ namespace utils
return pts > m_last_pts_incoming;
}
void video_provider::present_frame(std::vector<u8>& data, const u32 width, const u32 height, bool is_bgra)
void video_provider::present_frame(std::vector<u8>& data, u32 pitch, u32 width, u32 height, bool is_bgra)
{
std::lock_guard lock(m_mutex);
@ -132,6 +132,6 @@ namespace utils
m_last_pts_incoming = pts;
m_current_encoder_frame++;
m_image_sink->add_frame(data, width, height, is_bgra ? AVPixelFormat::AV_PIX_FMT_BGRA : AVPixelFormat::AV_PIX_FMT_RGBA, timestamp_ms);
m_image_sink->add_frame(data, pitch, width, height, is_bgra ? AVPixelFormat::AV_PIX_FMT_BGRA : AVPixelFormat::AV_PIX_FMT_RGBA, timestamp_ms);
}
}