本文整理汇总了Java中org.webrtc.RendererCommon.getDisplaySize方法的典型用法代码示例。如果您正苦于以下问题:Java RendererCommon.getDisplaySize方法的具体用法?Java RendererCommon.getDisplaySize怎么用?Java RendererCommon.getDisplaySize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.webrtc.RendererCommon
的用法示例。
在下文中一共展示了RendererCommon.getDisplaySize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDesiredLayoutSize
import org.webrtc.RendererCommon; //导入方法依赖的package包/类
private Point getDesiredLayoutSize(int widthSpec, int heightSpec) {
synchronized (layoutLock) {
final int maxWidth = getDefaultSize(Integer.MAX_VALUE, widthSpec);
final int maxHeight = getDefaultSize(Integer.MAX_VALUE, heightSpec);
final Point size =
RendererCommon.getDisplaySize(scalingType, frameAspectRatio(), maxWidth, maxHeight);
if (MeasureSpec.getMode(widthSpec) == MeasureSpec.EXACTLY) {
size.x = maxWidth;
}
if (MeasureSpec.getMode(heightSpec) == MeasureSpec.EXACTLY) {
size.y = maxHeight;
}
return size;
}
}
示例2: onLayout
import org.webrtc.RendererCommon; //导入方法依赖的package包/类
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
int height = b - t;
int width = r - l;
if (height == 0 || width == 0) {
l = t = r = b = 0;
} else {
int videoHeight;
int videoWidth;
synchronized (layoutSync) {
videoHeight = this.videoHeight;
videoWidth = this.videoWidth;
}
if (videoHeight == 0 || videoWidth == 0) {
// These are Twilio defaults.
videoHeight = 480;
videoWidth = 640;
}
Point displaySize = RendererCommon.getDisplaySize(
this.scalingType,
videoWidth / (float) videoHeight,
width,
height
);
l = (width - displaySize.x) / 2;
t = (height - displaySize.y) / 2;
r = l + displaySize.x;
b = t + displaySize.y;
}
surfaceViewRenderer.layout(l, t, r, b);
}
示例3: onLayout
import org.webrtc.RendererCommon; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
int height = b - t;
int width = r - l;
if (height == 0 || width == 0) {
l = t = r = b = 0;
} else {
int frameHeight;
int frameRotation;
int frameWidth;
ScalingType scalingType;
synchronized (layoutSyncRoot) {
frameHeight = this.frameHeight;
frameRotation = this.frameRotation;
frameWidth = this.frameWidth;
scalingType = this.scalingType;
}
SurfaceViewRenderer surfaceViewRenderer = getSurfaceViewRenderer();
switch (scalingType) {
case SCALE_ASPECT_FILL:
// Fill this ViewGroup with surfaceViewRenderer and the latter
// will take care of filling itself with the video similarly to
// the cover value the CSS property object-fit.
r = width;
l = 0;
b = height;
t = 0;
break;
case SCALE_ASPECT_FIT:
default:
// Lay surfaceViewRenderer out inside this ViewGroup in accord
// with the contain value of the CSS property object-fit.
// SurfaceViewRenderer will fill itself with the video similarly
// to the cover or contain value of the CSS property object-fit
// (which will not matter, eventually).
if (frameHeight == 0 || frameWidth == 0) {
l = t = r = b = 0;
} else {
float frameAspectRatio
= (frameRotation % 180 == 0)
? frameWidth / (float) frameHeight
: frameHeight / (float) frameWidth;
Point frameDisplaySize
= RendererCommon.getDisplaySize(
scalingType,
frameAspectRatio,
width, height);
l = (width - frameDisplaySize.x) / 2;
t = (height - frameDisplaySize.y) / 2;
r = l + frameDisplaySize.x;
b = t + frameDisplaySize.y;
}
break;
}
}
surfaceViewRenderer.layout(l, t, r, b);
}
示例4: onLayout
import org.webrtc.RendererCommon; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
int height = b - t;
int width = r - l;
if (height == 0 || width == 0) {
l = t = r = b = 0;
} else {
int frameHeight;
int frameRotation;
int frameWidth;
ScalingType scalingType;
synchronized (layoutSyncRoot) {
frameHeight = this.frameHeight;
frameRotation = this.frameRotation;
frameWidth = this.frameWidth;
scalingType = this.scalingType;
}
SurfaceViewRenderer surfaceViewRenderer = getSurfaceViewRenderer();
switch (scalingType) {
case SCALE_ASPECT_FILL:
// Fill this ViewGroup with surfaceViewRenderer and the latter
// will take care of filling itself with the video similarly to
// the cover value the CSS property object-fit.
r = width;
l = 0;
b = height;
t = 0;
break;
case SCALE_ASPECT_FIT:
default:
// Lay surfaceViewRenderer out inside this ViewGroup in accord
// with the contain value of the CSS property object-fit.
// SurfaceViewRenderer will fill itself with the video similarly
// to the cover or contain value of the CSS property object-fit
// (which will not matter, eventually).
if (frameHeight == 0 || frameWidth == 0) {
l = t = r = b = 0;
} else {
float frameAspectRatio
= (frameRotation % 180 == 0)
? frameWidth / (float) frameHeight
: frameHeight / (float) frameWidth;
Point frameDisplaySize
= RendererCommon.getDisplaySize(
scalingType,
frameAspectRatio,
width, height);
l = (width - frameDisplaySize.x) / 2;
t = (height - frameDisplaySize.y) / 2;
r = l + frameDisplaySize.x;
b = t + frameDisplaySize.y;
}
break;
}
}
surfaceViewRenderer.layout(l, t, r, b);
}