Fix(record): correct MJPEG upside-down playback

and remove 0-byte AVI residue on encoder open failure
This commit is contained in:
yuanyuanxiang
2026-05-23 12:09:14 +02:00
parent 99fc15ae41
commit 92bf9c9ccb
5 changed files with 17 additions and 7 deletions

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);
}