Skip to content

Commit

Permalink
android: fix sent video landscape rotation and add logging for previe…
Browse files Browse the repository at this point in the history
…w aspect ratio
  • Loading branch information
c-g-owen committed Oct 18, 2021
1 parent 818bceb commit 0cf9004
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion android/java/com/waz/avs/VideoCapturer.java
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ public int getRotation() {
if (camera == null || cameraInfo == null)
return 0;

return (360 - (cameraInfo.orientation + ui_rotation)) % 360;
return (360 + ui_rotation - cameraInfo.orientation) % 360;
}

public void setUIRotation(int rotation) {
Expand Down
3 changes: 3 additions & 0 deletions android/java/com/waz/avs/VideoPreview.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ protected void onLayout(boolean changed,
if (orientation % 180 != 0)
tAspRatio = 1.0f/aspectRatio;

Log.d(TAG, "onLayout: " + vWidth + "x" + vHeight + " ori: " + orientation +
" va: " + vAspRatio + " ta: " + tAspRatio);

float scaleX = Math.max(1.0f, tAspRatio / vAspRatio);
float scaleY = Math.max(1.0f, vAspRatio / tAspRatio);
float dx = - (scaleX * vWidth - vWidth) / 2.0f;
Expand Down

0 comments on commit 0cf9004

Please sign in to comment.