Skip to content

Commit

Permalink
fix bug. rs#79.
Browse files Browse the repository at this point in the history
  • Loading branch information
QiushiZhao committed Nov 5, 2020
1 parent af4728e commit fcd877f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions SDAVAssetExportSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,13 @@ - (AVMutableVideoComposition *)buildDefaultVideoComposition
CGSize targetSize = CGSizeMake([self.videoSettings[AVVideoWidthKey] floatValue], [self.videoSettings[AVVideoHeightKey] floatValue]);
CGSize naturalSize = [videoTrack naturalSize];
CGAffineTransform transform = videoTrack.preferredTransform;

CGRect rect = {{0, 0}, naturalSize};
CGRect transformedRect = CGRectApplyAffineTransform(rect, transform);
// transformedRect should have origin at 0 if correct; otherwise add offset to correct it
transform.tx -= transformedRect.origin.x;
transform.ty -= transformedRect.origin.y;

// Workaround radar 31928389, see https://github.com/rs/SDAVAssetExportSession/pull/70 for more info
if (transform.ty == -560) {
transform.ty = 0;
Expand Down

0 comments on commit fcd877f

Please sign in to comment.