修复连麦用户端默认用小流导致画面模糊的问题

This commit is contained in:
zlzw 2023-01-11 15:02:19 +08:00
parent eaafcdd444
commit 7226d54277
2 changed files with 16 additions and 15 deletions

View File

@ -186,9 +186,7 @@ public class LiveExoPlayerManager {
public void onPlayerError(@NonNull PlaybackException error) { public void onPlayerError(@NonNull PlaybackException error) {
Player.Listener.super.onPlayerError(error); Player.Listener.super.onPlayerError(error);
error.printStackTrace(); error.printStackTrace();
String url=LiveExoPlayerManager.this.url; replay();
LiveExoPlayerManager.this.url=null;
startUrl(url);
} }
}); });
@ -251,13 +249,12 @@ public class LiveExoPlayerManager {
Player.Listener.super.onIsLoadingChanged(isLoading); Player.Listener.super.onIsLoadingChanged(isLoading);
Log.i(TAG, "onIsLoadingChanged: 2 " + isLoading); Log.i(TAG, "onIsLoadingChanged: 2 " + isLoading);
} }
@Override @Override
public void onPlayerError(@NonNull PlaybackException error) { public void onPlayerError(@NonNull PlaybackException error) {
Player.Listener.super.onPlayerError(error); Player.Listener.super.onPlayerError(error);
error.printStackTrace(); error.printStackTrace();
String url=LiveExoPlayerManager.this.url; replay();
LiveExoPlayerManager.this.url=null;
startUrl(url);
} }
}); });
} }
@ -338,6 +335,7 @@ public class LiveExoPlayerManager {
public void play() { public void play() {
getNowPlayer().play(); getNowPlayer().play();
} }
public void replay() { public void replay() {
String tmp = url; String tmp = url;
url = null; url = null;

View File

@ -80,7 +80,9 @@ import cn.rongcloud.rtc.base.RCRTCMediaType;
import cn.rongcloud.rtc.base.RCRTCParamsType; import cn.rongcloud.rtc.base.RCRTCParamsType;
import cn.rongcloud.rtc.base.RCRTCRemoteVideoFrame; import cn.rongcloud.rtc.base.RCRTCRemoteVideoFrame;
import cn.rongcloud.rtc.base.RCRTCRoomType; import cn.rongcloud.rtc.base.RCRTCRoomType;
import cn.rongcloud.rtc.base.RCRTCStreamType;
import cn.rongcloud.rtc.base.RTCErrorCode; import cn.rongcloud.rtc.base.RTCErrorCode;
import cn.rongcloud.rtc.center.stream.RCRTCAudioInputStreamImpl;
public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
@ -1031,6 +1033,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
if (userinputStreamList1.size() == 0) { if (userinputStreamList1.size() == 0) {
//如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示 //如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示
RCRTCVideoView remoteView = new RCRTCVideoView(contexts); RCRTCVideoView remoteView = new RCRTCVideoView(contexts);
((RCRTCVideoInputStream) stream).setStreamType(RCRTCStreamType.NORMAL);
((RCRTCVideoInputStream) stream).setVideoView(remoteView); ((RCRTCVideoInputStream) stream).setVideoView(remoteView);
((RCRTCVideoInputStream) stream).setVideoFrameListener(new IRCRTCVideoInputFrameListener() { ((RCRTCVideoInputStream) stream).setVideoFrameListener(new IRCRTCVideoInputFrameListener() {
@Override @Override
@ -1040,7 +1043,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
"timestampNs:" + videoFrame.getTimestampNs() + "\n" + "timestampNs:" + videoFrame.getTimestampNs() + "\n" +
"分辨率:" + videoFrame.getBuffer().getHeight() + "x" + videoFrame.getBuffer().getWidth() + "\n" + "分辨率:" + videoFrame.getBuffer().getHeight() + "x" + videoFrame.getBuffer().getWidth() + "\n" +
"当前时间:" + new SimpleDateFormat("HH:mm:ss", Locale.CHINA).format(new Date()) + "\n"; "当前时间:" + new SimpleDateFormat("HH:mm:ss", Locale.CHINA).format(new Date()) + "\n";
System.out.println("debugText = " + debugText); Log.d("ry", "onFrame: " + debugText);
new Handler(Looper.getMainLooper()).post(() -> { new Handler(Looper.getMainLooper()).post(() -> {
debugView.setText(debugText); debugView.setText(debugText);