Commit b9b9e562 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk

call: use aspect fit for incoming video

Change-Id: Ife54c3dae69b601c987e72f00ecbe3297f329ad7
parent 66406431
......@@ -119,7 +119,7 @@ previewView, timeLabel, recordOnOffButton, sendButton, fileImage, infoLabel, tim
[view renderWithPixelBuffer: buffer
size: frameSize
rotation: 0
fillFrame: false];
fillFrame: true];
}
}
......
......@@ -227,14 +227,14 @@ std::string currentVideoDevice;
[view renderWithPixelBuffer:(CVPixelBufferRef)frame->data[3]
size: frameSize
rotation: rotation
fillFrame: false];
fillFrame: true];
return;
}
else if (CVPixelBufferRef pixBuffer = [self getBufferForPreviewFromFrame:frame]) {
[view renderWithPixelBuffer: pixBuffer
size: frameSize
rotation: rotation
fillFrame: false];
fillFrame: true];
}
}
}
......
......@@ -179,23 +179,10 @@ bool frameDisplayed = false;
float frameRatio = ((float)size.width)/((float)size.height);
simd::float4x4 projectionMatrix;
float ratio = viewRatio * (1/frameRatio);
if((viewRatio >= 1 && frameRatio >= 1) ||
(viewRatio < 1 && frameRatio < 1) ||
(ratio > 0.5 && ratio < 1.5) ) {
if (ratio <= 1.0 && ratio >= 0.5)
projectionMatrix = [self getScalingMatrix: 1/ratio axis: 'x'];
else if (ratio < 0.5)
projectionMatrix = [self getScalingMatrix: ratio axis: 'y'];
else if (ratio > 1 && ratio < 2)
projectionMatrix = [self getScalingMatrix: ratio axis: 'y'];
else
projectionMatrix = [self getScalingMatrix: 1/ratio axis: 'x'];
} else {
if (ratio < 1.0 && !fill || fill && ratio > 1.0)
projectionMatrix = [self getScalingMatrix: ratio axis: 'y'];
else
projectionMatrix = [self getScalingMatrix: 1/ratio axis: 'x'];
}
if (ratio < 1.0 && !fill || fill && ratio > 1.0)
projectionMatrix = [self getScalingMatrix: ratio axis: 'y'];
else
projectionMatrix = [self getScalingMatrix: 1/ratio axis: 'x'];
float radians = (-rotation * M_PI) / 180;
simd::float4x4 rotationMatrix = [self getRotationMatrix:radians];
Uniforms bytes = Uniforms{projectionMatrix: projectionMatrix, rotationMatrix: rotationMatrix};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment