Skip to content

Commit

Permalink
Fix video player crash on apple platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
halx99 committed Apr 14, 2024
1 parent 9f63883 commit 629e387
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/media/AvfMediaEngine.mm
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,8 @@ - (void)observeValueForKeyPath:(NSString*)keyPath
auto UVDataLen = UVPitch * UVHeight; // 1920x1080: UVDataLen=1036800
auto frameYData = (uint8_t*)CVPixelBufferGetBaseAddressOfPlane(videoFrame, 0);
auto frameCbCrData = (uint8_t*)CVPixelBufferGetBaseAddressOfPlane(videoFrame, 1);
assert(YASIO_SZ_ALIGN(videoDim.x, 32) * videoDim.y * 3 / 2 == YDataLen + UVDataLen);
assert(YASIO_SZ_ALIGN(videoDim.x, 32) * videoDim.y * 3 / 2 == YDataLen + UVDataLen ||
(32 - videoDim.x % 32 + videoDim.x) * videoDim.y * 3 / 2 == YDataLen + UVDataLen);
// Apple: both H264, HEVC(H265) bufferDimX=ALIGN(videoDim.x, 32), bufferDimY=videoDim.y
// Windows:
// - H264: BufferDimX align videoDim.x with 16, BufferDimY as-is
Expand Down

0 comments on commit 629e387

Please sign in to comment.