本文整理汇总了Java中org.webrtc.RendererCommon类的典型用法代码示例。如果您正苦于以下问题:Java RendererCommon类的具体用法?Java RendererCommon怎么用?Java RendererCommon使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RendererCommon类属于org.webrtc包,在下文中一共展示了RendererCommon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startTest
import org.webrtc.RendererCommon; //导入依赖的package包/类
@OnClick(R.id.mBtnStart)
public void startTest() {
mSurface.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT);
if (mRcTest != null && !mRcTest.finished()) {
Toast.makeText(this, "Last test still running", Toast.LENGTH_SHORT).show();
return;
}
mConfig = Config.builder()
.updateBr(mCbUpdateBr.isChecked())
.asyncEnc(mCbAsyncEnc.isChecked())
.initBr(Integer.parseInt(mEtInitBr.getText().toString()))
.brStep(Integer.parseInt(mEtBrStep.getText().toString()))
.quality(Integer.parseInt(mEtQuality.getText().toString()))
.brMode(mSpBitrateMode.getSelectedItemPosition())
.outputWidth(448)
.outputHeight(800)
.outputFps(30)
.outputKeyFrameInterval(2)
.build();
mRcTest = new RcTest(mConfig, mEglBase, mSurface, this);
mRcTest.start();
}
示例2: OnRtcOpenLocalRender
import org.webrtc.RendererCommon; //导入依赖的package包/类
/**
* Implements for AnyRTCViewEvents.
*/
@Override
public VideoRenderer OnRtcOpenLocalRender() {
int size = GetVideoRenderSize();
if (size == 0) {
mLocalRender = new VideoView("localRender", mVideoView.getContext(), mRootEglBase, 0, 0, 0, 100, 100);
} else {
mLocalRender = new VideoView("localRender", mVideoView.getContext(), mRootEglBase, size, SUB_X, (100 - size * (SUB_HEIGHT + SUB_Y)), SUB_WIDTH, SUB_HEIGHT);
mLocalRender.mView.setZOrderMediaOverlay(true);
}
mLocalRender.mView.setBackgroundResource(R.drawable.background);
mVideoView.addView(mLocalRender.mLayout);
mLocalRender.mLayout.setPosition(
mLocalRender.x, mLocalRender.y, mLocalRender.w, mLocalRender.h);
mLocalRender.mView.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FILL);
mLocalRender.mRenderer = new VideoRenderer(mLocalRender.mView);
mLocalRender.mLayout.setBackgroundResource(R.drawable.background);
return mLocalRender.mRenderer;
}
示例3: OnRtcOpenPreViewRender
import org.webrtc.RendererCommon; //导入依赖的package包/类
public VideoRenderer OnRtcOpenPreViewRender(String strRtcPeerId){
VideoView remoteRender = mRemoteRenders.get(strRtcPeerId);
if (remoteRender == null) {
int size = GetVideoRenderSize();
if (size == 0) {
remoteRender = new VideoView(strRtcPeerId, mVideoView.getContext(), mRootEglBase, 0, 0, 0, 100, 100);
} else {
remoteRender = new VideoView(strRtcPeerId, mVideoView.getContext(), mRootEglBase, size, (100-SUB_WIDTH)/2, 12, SUB_WIDTH, SUB_HEIGHT);
remoteRender.mView.setZOrderMediaOverlay(true);
}
mVideoView.addView(remoteRender.mLayout);
remoteRender.mLayout.setPosition(
remoteRender.x, remoteRender.y, remoteRender.w, remoteRender.h);
remoteRender.mView.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FILL);
remoteRender.mRenderer = new VideoRenderer(remoteRender.mView);
mRemoteRenders.put(strRtcPeerId, remoteRender);
}
return remoteRender.mRenderer;
}
示例4: AVMemberView
import org.webrtc.RendererCommon; //导入依赖的package包/类
public AVMemberView(final Context context,EglBase rootEglBase,AVMember avMember, String trackType){
this.context = context;
this.rootEglBase = rootEglBase;
this.avMember = avMember;
this.trackType = trackType;
convertView = LayoutInflater.from(context).inflate(R.layout.avcall_member_preview_item, null);
viewHolder = new ViewHolder();
viewHolder.sfv_video= (SurfaceViewRenderer)convertView.findViewById(R.id.svr_video_item);
viewHolder.iv_header = (ImageView) convertView.findViewById(R.id.iv_av_member_avatar);
viewHolder.rl_bg = (RelativeLayout) convertView.findViewById(R.id.rl_bg);
viewHolder.sfv_video.init(rootEglBase.getEglBaseContext(), null);
viewHolder.sfv_video.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT);
viewHolder.sfv_video.setMirror(false);
viewHolder.sfv_video.setZOrderMediaOverlay(true);
convertView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (onMemberViewClickListener != null)
onMemberViewClickListener.itemClick(avMemberView);
}
});
avMemberView = this;
setRenderer();
}
示例5: updateVideoView
import org.webrtc.RendererCommon; //导入依赖的package包/类
protected void updateVideoView() {
remoteRenderLayout.setPosition(REMOTE_X, REMOTE_Y, REMOTE_WIDTH, REMOTE_HEIGHT);
remoteRenderScreen.setScalingType(scalingType);
remoteRenderScreen.setMirror(false);
if (iceConnected) {
localRenderLayout.setPosition(
LOCAL_X_CONNECTED, LOCAL_Y_CONNECTED, LOCAL_WIDTH_CONNECTED, LOCAL_HEIGHT_CONNECTED);
localRender.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT);
} else {
localRenderLayout.setPosition(
LOCAL_X_CONNECTING, LOCAL_Y_CONNECTING, LOCAL_WIDTH_CONNECTING, LOCAL_HEIGHT_CONNECTING);
localRender.setScalingType(scalingType);
}
localRender.setMirror(true);
localRender.requestLayout();
remoteRenderScreen.requestLayout();
}
示例6: 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;
}
}
示例7: OnRtcOpenLocalRender
import org.webrtc.RendererCommon; //导入依赖的package包/类
/**
* Implements for AnyRTCViewEvents.
*/
@Override
public VideoRenderer OnRtcOpenLocalRender() {
int size = GetVideoRenderSize();
screenChange();
if (size == 0) {
if (mRTCVideoLayout == AnyRTCVideoLayout.AnyRTC_V_1X3) {
mLocalRender = new VideoView("localRender", mVideoView.getContext(), mRootEglBase, 0, 0, 0, 100, 100, mRTCVideoLayout);
} else {
mLocalRender = new VideoView("localRender", mVideoView.getContext(), mRootEglBase, 0, 0, 0, 100, 100, mRTCVideoLayout);
}
} else {
mLocalRender = new VideoView("localRender", mVideoView.getContext(), mRootEglBase, size, SUB_X, (100 - size * (SUB_HEIGHT + SUB_Y)), SUB_WIDTH, SUB_HEIGHT, mRTCVideoLayout);
}
if (mRTCVideoLayout == AnyRTCVideoLayout.AnyRTC_V_1X3) {
mVideoView.addView(mLocalRender.mLayout, -1);
} else {
mVideoView.addView(mLocalRender.mLayout, 0);
}
mLocalRender.mLayout.setPosition(
mLocalRender.x, mLocalRender.y, mLocalRender.w, mLocalRender.h);
mLocalRender.mView.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FILL);
mLocalRender.mRenderer = new VideoRenderer(mLocalRender.mView);
return mLocalRender.mRenderer;
}
示例8: OnRtcOpenRemoteRender
import org.webrtc.RendererCommon; //导入依赖的package包/类
@Override
public VideoRenderer OnRtcOpenRemoteRender(final String strRtcPeerId) {
VideoView remoteRender = mRemoteRenders.get(strRtcPeerId);
if (remoteRender == null) {
int size = GetVideoRenderSize();
if (size == 0) {
remoteRender = new VideoView(strRtcPeerId, mVideoView.getContext(), mRootEglBase, 0, 0, 0, 100, 100);
} else {
remoteRender = new VideoView(strRtcPeerId, mVideoView.getContext(), mRootEglBase, size, 4, 4, SUB_WIDTH, SUB_HEIGHT);
remoteRender.mView.setZOrderMediaOverlay(true);
}
mVideoView.addView(remoteRender.mLayout);
remoteRender.mLayout.setPosition(
remoteRender.x, remoteRender.y, remoteRender.w, remoteRender.h);
remoteRender.mView.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FILL);
remoteRender.mRenderer = new VideoRenderer(remoteRender.mView);
mRemoteRenders.put(strRtcPeerId, remoteRender);
if (mRemoteRenders.size() == 1 && mLocalRender != null) {
SwitchViewToFullscreen(remoteRender, mLocalRender);
}
}
return remoteRender.mRenderer;
}
示例9: init
import org.webrtc.RendererCommon; //导入依赖的package包/类
/**
* Initialize this class, sharing resources with |sharedContext|. The custom |drawer| will be used
* for drawing frames on the EGLSurface. This class is responsible for calling release() on
* |drawer|. It is allowed to call init() to reinitialize the renderer after a previous
* init()/release() cycle.
*/
public void init(final EglBase.Context sharedContext,
RendererCommon.RendererEvents rendererEvents, final int[] configAttributes,
RendererCommon.GlDrawer drawer) {
ThreadUtils.checkIsOnMainThread();
this.rendererEvents = rendererEvents;
synchronized (layoutLock) {
isFirstFrameRendered = false;
rotatedFrameWidth = 0;
rotatedFrameHeight = 0;
frameRotation = 0;
}
eglRenderer.init(sharedContext, configAttributes, drawer);
}
示例10: 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);
}
示例11: onStart
import org.webrtc.RendererCommon; //导入依赖的package包/类
@Override
protected void onStart() {
super.onStart();
Bundle extras = getIntent().getExtras();
this.username = extras.getString(Constants.USER_NAME, "");
Log.i(TAG, "username: " + username);
EglBase rootEglBase = EglBase.create();
masterView.init(rootEglBase.getEglBaseContext(), null);
masterView.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FILL);
localView.init(rootEglBase.getEglBaseContext(), null);
localView.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FILL);
NBMMediaConfiguration peerConnectionParameters = new NBMMediaConfiguration(
NBMMediaConfiguration.NBMRendererType.OPENGLES,
NBMMediaConfiguration.NBMAudioCodec.OPUS, 0,
NBMMediaConfiguration.NBMVideoCodec.VP8, 0,
new NBMMediaConfiguration.NBMVideoFormat(352, 288, PixelFormat.RGB_888, 20),
NBMMediaConfiguration.NBMCameraPosition.FRONT);
videoRequestUserMapping = new HashMap<>();
nbmWebRTCPeer = new NBMWebRTCPeer(peerConnectionParameters, this, localView, this);
nbmWebRTCPeer.registerMasterRenderer(masterView);
Log.i(TAG, "Initializing nbmWebRTCPeer...");
nbmWebRTCPeer.initialize();
callState = CallState.PUBLISHING;
mCallStatus.setText("Publishing...");
}
示例12: updateVideoView
import org.webrtc.RendererCommon; //导入依赖的package包/类
/**
* Updated layout of the views.
*/
private void updateVideoView(final String videoUri) {
mRemoteLayout.setPosition(0, 0, 100, 90);
mRemoteRender.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT);
mRemoteRender.setMirror(false);
mLocalLayout.setPosition(72, 72, 25, 25);
mLocalRender.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT);
mLocalRender.setMirror("true".equals(videoUri));
mLocalRender.requestLayout();
mRemoteRender.requestLayout();
}
示例13: updateRenderer
import org.webrtc.RendererCommon; //导入依赖的package包/类
public void updateRenderer(RendererSurface rendererSurface, RendererConfig config){
boolean mainRenderer = RendererSurface.MAIN.equals(rendererSurface);
VideoRenderer.Callbacks callbacks = mainRenderer ? mainRendererCallback
:localRendererCallback;
if (config.coordinates != null) {
setViewCoordinates((mainRenderer ? remoteCoords : localCoords),
config.coordinates);
}
setRendererMirror(config.mirror, rendererSurface);
int[] viewCoordinates = mainRenderer ? remoteCoords : localCoords;
VideoRendererGui.update(callbacks, viewCoordinates[0], viewCoordinates[1], viewCoordinates[2],
viewCoordinates[3], RendererCommon.ScalingType.SCALE_ASPECT_FILL,
(mainRenderer ? mainMirror : secondMirror));
}
示例14: init
import org.webrtc.RendererCommon; //导入依赖的package包/类
/**
* Initialize this class, sharing resources with |sharedContext|. It is allowed to call init() to
* reinitialize the renderer after a previous init()/release() cycle.
*/
public void init(
EglBase.Context sharedContext, RendererCommon.RendererEvents rendererEvents) {
init(sharedContext, rendererEvents, EglBase.CONFIG_PLAIN, new GlRectDrawer());
}
示例15: setScalingType
import org.webrtc.RendererCommon; //导入依赖的package包/类
/**
* Set how the video will fill the allowed layout area.
*/
public void setScalingType(RendererCommon.ScalingType scalingType) {
synchronized (layoutLock) {
this.scalingType = scalingType;
}
}