Fix(record): correct MJPEG upside-down playback

and remove 0-byte AVI residue on encoder open failure
This commit is contained in:
yuanyuanxiang committed 2026-05-23 13:37:28 +02:00
1 parent 99fc15ae41
commit 92bf9c9ccb
5 files changed
+17 -7

No files matched your search

+3 -3
View File
@@ -284,13 +284,13 @@ bool BmpToJpeg(LPVOID lpBuffer, int width, int height, int quality,
return false;
}
// 复制数据(注意:DIB 是底部到顶部,需要翻转)
// 输入已为 top-down 的紧凑 BGR24(调用方已通过 Process24BitBmp /
// ConvertScreenshot32to24 完成翻转与去对齐),此处直接按行拷贝即可
BYTE* srcData = (BYTE*)lpBuffer;
BYTE* dstData = (BYTE*)bitmapData.Scan0;
for (int y = 0; y < height; y++) {
// DIB 是从底部开始的,所以需要翻转
BYTE* srcRow = srcData + (height - 1 - y) * rowSize;
BYTE* srcRow = srcData + y * rowSize;
BYTE* dstRow = dstData + y * bitmapData.Stride;
memcpy(dstRow, srcRow, width * 3);
}