Add unscaled getWidth/Height to TextureBuffer interface
Bug: b/289762633
Change-Id: I36a8c108ca03d464cd4dd08441dc9b64077343c1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/316860
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Fabian Bergmark <fabianbergmark@google.com>
Cr-Commit-Position: refs/heads/main@{#40567}
diff --git a/sdk/android/api/org/webrtc/TextureBufferImpl.java b/sdk/android/api/org/webrtc/TextureBufferImpl.java
index c08fc4c..7e2bed8 100644
--- a/sdk/android/api/org/webrtc/TextureBufferImpl.java
+++ b/sdk/android/api/org/webrtc/TextureBufferImpl.java
@@ -140,18 +140,12 @@
(int) Math.round(unscaledHeight * cropHeight / (float) height), scaleWidth, scaleHeight);
}
- /**
- * Returns the width of the texture in memory. This should only be used for downscaling, and you
- * should still respect the width from getWidth().
- */
+ @Override
public int getUnscaledWidth() {
return unscaledWidth;
}
- /**
- * Returns the height of the texture in memory. This should only be used for downscaling, and you
- * should still respect the height from getHeight().
- */
+ @Override
public int getUnscaledHeight() {
return unscaledHeight;
}
diff --git a/sdk/android/api/org/webrtc/VideoFrame.java b/sdk/android/api/org/webrtc/VideoFrame.java
index 52a378b..443a031 100644
--- a/sdk/android/api/org/webrtc/VideoFrame.java
+++ b/sdk/android/api/org/webrtc/VideoFrame.java
@@ -146,6 +146,22 @@
Matrix transformMatrix, int newWidth, int newHeight) {
throw new UnsupportedOperationException("Not implemented");
}
+
+ /**
+ * Returns the width of the texture in memory. This should only be used for downscaling, and you
+ * should still respect the width from getWidth().
+ */
+ default public int getUnscaledWidth() {
+ return getWidth();
+ }
+
+ /**
+ * Returns the height of the texture in memory. This should only be used for downscaling, and
+ * you should still respect the height from getHeight().
+ */
+ default public int getUnscaledHeight() {
+ return getHeight();
+ }
}
private final Buffer buffer;