修改主播端发布远端流分辨率问题
This commit is contained in:
parent
d480986485
commit
652e569e2b
@ -0,0 +1,6 @@
|
|||||||
|
package com.yunbao.common.event;
|
||||||
|
|
||||||
|
import com.yunbao.common.bean.BaseModel;
|
||||||
|
|
||||||
|
public class LivePushRyEvent extends BaseModel {
|
||||||
|
}
|
@ -212,27 +212,27 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
Bus.getOn(this);
|
Bus.getOn(this);
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
initFaceManager();
|
initFaceManager();
|
||||||
// RCRTCEngine.getInstance().registerStatusReportListener(new IRCRTCStatusReportListener() {
|
RCRTCEngine.getInstance().registerStatusReportListener(new IRCRTCStatusReportListener() {
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void onConnectionStats(StatusReport statusReport) {
|
public void onConnectionStats(StatusReport statusReport) {
|
||||||
// //视频发送信息
|
//视频发送信息
|
||||||
// for (Map.Entry<String, StatusBean> entry : statusReport.statusVideoSends.entrySet()) {
|
for (Map.Entry<String, StatusBean> entry : statusReport.statusVideoSends.entrySet()) {
|
||||||
// StatusBean statusBean = entry.getValue();
|
StatusBean statusBean = entry.getValue();
|
||||||
// //获取userID
|
//获取userID
|
||||||
// String userId = statusBean.uid;
|
String userId = statusBean.uid;
|
||||||
// //获取视频 宽x高@帧率
|
//获取视频 宽x高@帧率
|
||||||
// String resolution = statusBean.frameWidth + "x" + statusBean.frameHeight + "@" + statusBean.frameRate;
|
String resolution = statusBean.frameWidth + "x" + statusBean.frameHeight + "@" + statusBean.frameRate;
|
||||||
// //获取码率
|
//获取码率
|
||||||
// long bitRate = statusBean.bitRate;
|
long bitRate = statusBean.bitRate;
|
||||||
// //丢包率
|
//丢包率
|
||||||
// long lossRate = statusBean.packetLostRate;
|
long lossRate = statusBean.packetLostRate;
|
||||||
// //带宽
|
//带宽
|
||||||
// String googAvailableSendBandwidth = statusReport.googAvailableSendBandwidth;
|
String googAvailableSendBandwidth = statusReport.googAvailableSendBandwidth;
|
||||||
// Log.e("网速和内存", "码率:" +bitRate+ " 丢包率:" + lossRate+" 带宽:"+googAvailableSendBandwidth);
|
Log.e("网速和内存", "获取视频:" +resolution+ " 丢包率:" + lossRate+" 带宽:"+googAvailableSendBandwidth);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
leave_img = findViewById(R.id.leave_img);
|
leave_img = findViewById(R.id.leave_img);
|
||||||
mLiveSDK = intent.getIntExtra(Constants.LIVE_SDK, Constants.LIVE_SDK_KSY);
|
mLiveSDK = intent.getIntExtra(Constants.LIVE_SDK, Constants.LIVE_SDK_KSY);
|
||||||
mLiveKsyConfigBean = intent.getParcelableExtra(Constants.LIVE_KSY_CONFIG);
|
mLiveKsyConfigBean = intent.getParcelableExtra(Constants.LIVE_KSY_CONFIG);
|
||||||
|
@ -9,7 +9,6 @@ import android.os.Bundle;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.format.Formatter;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -29,12 +28,13 @@ import com.yunbao.common.Constants;
|
|||||||
import com.yunbao.common.bean.LiveClassBean;
|
import com.yunbao.common.bean.LiveClassBean;
|
||||||
import com.yunbao.common.bean.LiveRoomTypeBean;
|
import com.yunbao.common.bean.LiveRoomTypeBean;
|
||||||
import com.yunbao.common.bean.UserBean;
|
import com.yunbao.common.bean.UserBean;
|
||||||
|
import com.yunbao.common.event.LivePushRyEvent;
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
import com.yunbao.common.interfaces.CommonCallback;
|
import com.yunbao.common.interfaces.CommonCallback;
|
||||||
import com.yunbao.common.interfaces.ImageResultCallback;
|
import com.yunbao.common.interfaces.ImageResultCallback;
|
||||||
import com.yunbao.common.manager.IMLoginManager;
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
import com.yunbao.common.utils.DeviceUtils;
|
import com.yunbao.common.utils.Bus;
|
||||||
import com.yunbao.common.utils.DialogUitl;
|
import com.yunbao.common.utils.DialogUitl;
|
||||||
import com.yunbao.common.utils.L;
|
import com.yunbao.common.utils.L;
|
||||||
import com.yunbao.common.utils.ProcessImageUtil;
|
import com.yunbao.common.utils.ProcessImageUtil;
|
||||||
@ -63,12 +63,8 @@ import org.greenrobot.eventbus.Subscribe;
|
|||||||
import org.greenrobot.eventbus.ThreadMode;
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import cn.rongcloud.rtc.api.RCRTCEngine;
|
import cn.rongcloud.rtc.api.RCRTCEngine;
|
||||||
import cn.rongcloud.rtc.api.callback.IRCRTCStatusReportListener;
|
|
||||||
import cn.rongcloud.rtc.api.report.StatusBean;
|
|
||||||
import cn.rongcloud.rtc.api.report.StatusReport;
|
|
||||||
import cn.rongcloud.rtc.api.stream.RCRTCCameraOutputStream;
|
import cn.rongcloud.rtc.api.stream.RCRTCCameraOutputStream;
|
||||||
import cn.rongcloud.rtc.api.stream.RCRTCVideoStreamConfig;
|
import cn.rongcloud.rtc.api.stream.RCRTCVideoStreamConfig;
|
||||||
import cn.rongcloud.rtc.base.RCRTCParamsType;
|
import cn.rongcloud.rtc.base.RCRTCParamsType;
|
||||||
@ -215,8 +211,8 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
|||||||
// DeviceUtils.getNetSpeed(mContext);//获取当前上传网速
|
// DeviceUtils.getNetSpeed(mContext);//获取当前上传网速
|
||||||
// Log.e("网速和内存", "内存:" + + " 网速:" + DeviceUtils.getNetSpeed(mContext));
|
// Log.e("网速和内存", "内存:" + + " 网速:" + DeviceUtils.getNetSpeed(mContext));
|
||||||
|
|
||||||
selectClarity = IMLoginManager.get(mContext).getSelectClarity();
|
IMLoginManager.get(mContext).setSelectClarity(selectClarity);
|
||||||
setSelectClarity(selectClarity);
|
setSelectClarity(IMLoginManager.get(mContext).getSelectClarity());
|
||||||
ViewClicksAntiShake
|
ViewClicksAntiShake
|
||||||
.clicksAntiShake(
|
.clicksAntiShake(
|
||||||
findViewById(R.id.btn_live_clarity), () -> {
|
findViewById(R.id.btn_live_clarity), () -> {
|
||||||
@ -327,6 +323,9 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
|||||||
.setVideoResolution(rcrtcVideoResolution)
|
.setVideoResolution(rcrtcVideoResolution)
|
||||||
.build();
|
.build();
|
||||||
RCRTCEngine.getInstance().getDefaultVideoStream().setVideoConfig(config);
|
RCRTCEngine.getInstance().getDefaultVideoStream().setVideoConfig(config);
|
||||||
|
Log.e("切换分辨率", "时间戳" + System.currentTimeMillis());
|
||||||
|
//重新发布一下流
|
||||||
|
Bus.get().post(new LivePushRyEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setManager(FaceManager manager) {
|
public void setManager(FaceManager manager) {
|
||||||
@ -334,7 +333,6 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (!canClick()) {
|
if (!canClick()) {
|
||||||
@ -364,7 +362,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// startLive();
|
// startLive();
|
||||||
liveOpenCustomPopup = new LiveOpenCustomPopup(mContext, selectClarity, classBean, liveRoomTypeBean)
|
liveOpenCustomPopup = new LiveOpenCustomPopup(mContext, IMLoginManager.get(mContext).getSelectClarity(), classBean, liveRoomTypeBean)
|
||||||
.setCallBack(new LiveOpenCustomPopup.LiveOpenCallBack() {
|
.setCallBack(new LiveOpenCustomPopup.LiveOpenCallBack() {
|
||||||
@Override
|
@Override
|
||||||
|
|
||||||
@ -384,7 +382,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
|||||||
LiveClarityCustomPopup liveClarityCustomPopup =
|
LiveClarityCustomPopup liveClarityCustomPopup =
|
||||||
new LiveClarityCustomPopup(mContext,
|
new LiveClarityCustomPopup(mContext,
|
||||||
IMLoginManager.get(mContext).getSelectClarity(),
|
IMLoginManager.get(mContext).getSelectClarity(),
|
||||||
IMLoginManager.get(mContext).getClarity() ? 0 : LiveClarityCustomPopup.BAN_1080, false);
|
IMLoginManager.get(mContext).getClarity() ? 0 : LiveClarityCustomPopup.BAN_1080, false);
|
||||||
new XPopup.Builder(mContext)
|
new XPopup.Builder(mContext)
|
||||||
.setPopupCallback(new XPopupCallback() {
|
.setPopupCallback(new XPopupCallback() {
|
||||||
@Override
|
@Override
|
||||||
@ -821,7 +819,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String title = mEditTitle.getText().toString().trim();
|
String title = mEditTitle.getText().toString().trim();
|
||||||
LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, mAvatarFile, selectClarity + 1, new HttpCallback() {
|
LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, mAvatarFile, IMLoginManager.get(mContext).getSelectClarity() + 1, new HttpCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(int code, String msg, final String[] info) {
|
public void onSuccess(int code, String msg, final String[] info) {
|
||||||
if (code == 0 && info.length > 0) {
|
if (code == 0 && info.length > 0) {
|
||||||
|
@ -34,6 +34,7 @@ import com.yunbao.common.Constants;
|
|||||||
import com.yunbao.common.bean.HttpCallbackModel;
|
import com.yunbao.common.bean.HttpCallbackModel;
|
||||||
import com.yunbao.common.bean.UserBean;
|
import com.yunbao.common.bean.UserBean;
|
||||||
import com.yunbao.common.event.AnchorInfoEvent;
|
import com.yunbao.common.event.AnchorInfoEvent;
|
||||||
|
import com.yunbao.common.event.LivePushRyEvent;
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
import com.yunbao.common.http.HttpClient;
|
import com.yunbao.common.http.HttpClient;
|
||||||
@ -41,6 +42,7 @@ import com.yunbao.common.http.live.LiveNetManager;
|
|||||||
import com.yunbao.common.manager.IMLoginManager;
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
import com.yunbao.common.manager.IMRTCManager;
|
import com.yunbao.common.manager.IMRTCManager;
|
||||||
import com.yunbao.common.manager.RandomPkManager;
|
import com.yunbao.common.manager.RandomPkManager;
|
||||||
|
import com.yunbao.common.utils.Bus;
|
||||||
import com.yunbao.common.utils.DialogUitl;
|
import com.yunbao.common.utils.DialogUitl;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
import com.yunbao.common.utils.L;
|
import com.yunbao.common.utils.L;
|
||||||
@ -71,14 +73,12 @@ import cn.rongcloud.rtc.api.RCRTCRoomConfig;
|
|||||||
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
|
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
|
||||||
import cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback;
|
import cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback;
|
||||||
import cn.rongcloud.rtc.api.callback.IRCRTCRoomEventsListener;
|
import cn.rongcloud.rtc.api.callback.IRCRTCRoomEventsListener;
|
||||||
import cn.rongcloud.rtc.api.callback.IRCRTCVideoOutputFrameListener;
|
|
||||||
import cn.rongcloud.rtc.api.stream.RCRTCInputStream;
|
import cn.rongcloud.rtc.api.stream.RCRTCInputStream;
|
||||||
import cn.rongcloud.rtc.api.stream.RCRTCLiveInfo;
|
import cn.rongcloud.rtc.api.stream.RCRTCLiveInfo;
|
||||||
import cn.rongcloud.rtc.api.stream.RCRTCVideoStreamConfig;
|
import cn.rongcloud.rtc.api.stream.RCRTCVideoStreamConfig;
|
||||||
import cn.rongcloud.rtc.api.stream.RCRTCVideoView;
|
import cn.rongcloud.rtc.api.stream.RCRTCVideoView;
|
||||||
import cn.rongcloud.rtc.base.RCRTCParamsType;
|
import cn.rongcloud.rtc.base.RCRTCParamsType;
|
||||||
import cn.rongcloud.rtc.base.RCRTCRoomType;
|
import cn.rongcloud.rtc.base.RCRTCRoomType;
|
||||||
import cn.rongcloud.rtc.base.RCRTCVideoFrame;
|
|
||||||
import cn.rongcloud.rtc.base.RTCErrorCode;
|
import cn.rongcloud.rtc.base.RTCErrorCode;
|
||||||
import cn.rongcloud.rtc.core.CameraVideoCapturer;
|
import cn.rongcloud.rtc.core.CameraVideoCapturer;
|
||||||
import cn.rongcloud.rtc.core.RendererCommon;
|
import cn.rongcloud.rtc.core.RendererCommon;
|
||||||
@ -396,6 +396,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
|||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
super.init();
|
super.init();
|
||||||
|
Bus.getOn(this);
|
||||||
mPreView = (FrameLayout) findViewById(R.id.camera_preview);
|
mPreView = (FrameLayout) findViewById(R.id.camera_preview);
|
||||||
mPreView1 = (FrameLayout) findViewById(R.id.camera_preview1);
|
mPreView1 = (FrameLayout) findViewById(R.id.camera_preview1);
|
||||||
dr1_preview = (FrameLayout) findViewById(R.id.dr1_preview);
|
dr1_preview = (FrameLayout) findViewById(R.id.dr1_preview);
|
||||||
@ -775,17 +776,6 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
|||||||
videoLayout1.setY(0); //Y 坐标
|
videoLayout1.setY(0); //Y 坐标
|
||||||
videoLayout1.setWidth(720); // 视频窗口的宽
|
videoLayout1.setWidth(720); // 视频窗口的宽
|
||||||
videoLayout1.setHeight(1280); // 视频窗口的高
|
videoLayout1.setHeight(1280); // 视频窗口的高
|
||||||
//不能设置setVideoFrameListener,会影响到美颜
|
|
||||||
/* RCRTCEngine.getInstance().getDefaultVideoStream().setVideoFrameListener(new IRCRTCVideoOutputFrameListener() {
|
|
||||||
@Override
|
|
||||||
public RCRTCVideoFrame processVideoFrame(RCRTCVideoFrame rtcVideoFrame) {
|
|
||||||
// 使用数据进行美颜/录像等处理后,需要把数据再返回给 SDK 做发送。
|
|
||||||
// rtcVideoFrame.setTextureId(tencentTRTCBeautyManager.renderWithTexture(rtcVideoFrame.getTextureId(), rtcVideoFrame.getWidth(), rtcVideoFrame.getHeight(), false));
|
|
||||||
Log.e("视频流", "Width---------------------" + rtcVideoFrame.getWidth());
|
|
||||||
Log.e("视频流", "Height---------------------" + rtcVideoFrame.getHeight());
|
|
||||||
return rtcVideoFrame;
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
//2. 合流画布设置
|
//2. 合流画布设置
|
||||||
rcrtcLiveInfo.setMixConfig(config, new IRCRTCResultCallback() {
|
rcrtcLiveInfo.setMixConfig(config, new IRCRTCResultCallback() {
|
||||||
@Override
|
@Override
|
||||||
@ -858,6 +848,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
|||||||
@Override
|
@Override
|
||||||
public void release() {
|
public void release() {
|
||||||
super.release();
|
super.release();
|
||||||
|
Bus.getOff(this);
|
||||||
LiveHttpUtil.cancel(LiveHttpConsts.LINK_MIC_TX_MIX_STREAM);
|
LiveHttpUtil.cancel(LiveHttpConsts.LINK_MIC_TX_MIX_STREAM);
|
||||||
rtcRoom = null;
|
rtcRoom = null;
|
||||||
}
|
}
|
||||||
@ -913,4 +904,19 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
|||||||
return ((LiveActivity) mContext).getTxAppId();
|
return ((LiveActivity) mContext).getTxAppId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
public void setSelectClarity(LivePushRyEvent event) {
|
||||||
|
if (rtcRoom != null)
|
||||||
|
rtcRoom.getLocalUser().publishDefaultLiveStreams(new IRCRTCResultDataCallback<RCRTCLiveInfo>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(RCRTCLiveInfo rcrtcLiveInfo1) {
|
||||||
|
rcrtcLiveInfo = rcrtcLiveInfo1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailed(RTCErrorCode rtcErrorCode) {
|
||||||
|
Log.e("ry", "rtcErrorCode" + rtcErrorCode);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user