修复连麦用户端默认用小流导致画面模糊的问题
This commit is contained in:
parent
eaafcdd444
commit
7226d54277
@ -157,7 +157,7 @@ public class LiveExoPlayerManager {
|
|||||||
mainView.setPlayer(player1);
|
mainView.setPlayer(player1);
|
||||||
status = MODEL_PLAY1;
|
status = MODEL_PLAY1;
|
||||||
isSwitchUrl = false;
|
isSwitchUrl = false;
|
||||||
if(getNextPlayer().isPlaying()){
|
if (getNextPlayer().isPlaying()) {
|
||||||
getNextPlayer().stop();
|
getNextPlayer().stop();
|
||||||
}
|
}
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
@ -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);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -227,7 +225,7 @@ public class LiveExoPlayerManager {
|
|||||||
//ToastUtil.show(String.format(Locale.CHINA, "从加载到播放 = %.3f,最大耗时 = %.3f", tmp, log_buffer_max_time));
|
//ToastUtil.show(String.format(Locale.CHINA, "从加载到播放 = %.3f,最大耗时 = %.3f", tmp, log_buffer_max_time));
|
||||||
log_buffer_time = -1;
|
log_buffer_time = -1;
|
||||||
status = MODEL_PLAY2;
|
status = MODEL_PLAY2;
|
||||||
if(getNextPlayer().isPlaying()){
|
if (getNextPlayer().isPlaying()) {
|
||||||
getNextPlayer().stop();
|
getNextPlayer().stop();
|
||||||
}
|
}
|
||||||
isSwitchUrl = false;
|
isSwitchUrl = false;
|
||||||
@ -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);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -268,7 +265,7 @@ public class LiveExoPlayerManager {
|
|||||||
* @param url 地址
|
* @param url 地址
|
||||||
*/
|
*/
|
||||||
public void startUrl(String url) {
|
public void startUrl(String url) {
|
||||||
if (url!=null&&url.equals(this.url)) return;
|
if (url != null && url.equals(this.url)) return;
|
||||||
Log.i(TAG, "startUrl: " + url + " > " + mainView.getResizeMode());
|
Log.i(TAG, "startUrl: " + url + " > " + mainView.getResizeMode());
|
||||||
this.url = url;
|
this.url = url;
|
||||||
isSwitchUrl = true;
|
isSwitchUrl = true;
|
||||||
@ -289,7 +286,7 @@ public class LiveExoPlayerManager {
|
|||||||
* @param url 地址
|
* @param url 地址
|
||||||
*/
|
*/
|
||||||
public void switchUrl(String url) {
|
public void switchUrl(String url) {
|
||||||
if (url!=null&&url.equals(this.url)) return;
|
if (url != null && url.equals(this.url)) return;
|
||||||
Log.i(TAG, "switchUrl: " + url + " src : " + this.url);
|
Log.i(TAG, "switchUrl: " + url + " src : " + this.url);
|
||||||
this.url = url;
|
this.url = url;
|
||||||
playBufferIndex = 0;
|
playBufferIndex = 0;
|
||||||
@ -338,9 +335,10 @@ public class LiveExoPlayerManager {
|
|||||||
public void play() {
|
public void play() {
|
||||||
getNowPlayer().play();
|
getNowPlayer().play();
|
||||||
}
|
}
|
||||||
public void replay(){
|
|
||||||
String tmp=url;
|
public void replay() {
|
||||||
url=null;
|
String tmp = url;
|
||||||
|
url = null;
|
||||||
startUrl(tmp);
|
startUrl(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 {
|
||||||
|
|
||||||
@ -342,7 +344,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
|||||||
public void switchStreamPk(boolean isPk) {
|
public void switchStreamPk(boolean isPk) {
|
||||||
super.switchStreamPk(isPk);
|
super.switchStreamPk(isPk);
|
||||||
Log.i(TAG, "switchStreamPk: isPk1" + isPk + " tmp = " + !tmpPk + " isPk2 = " + this.isPk);
|
Log.i(TAG, "switchStreamPk: isPk1" + isPk + " tmp = " + !tmpPk + " isPk2 = " + this.isPk);
|
||||||
if(this.isPk&&tmpPk)return;
|
if (this.isPk && tmpPk) return;
|
||||||
if (isPk && !tmpPk || this.isPk) {
|
if (isPk && !tmpPk || this.isPk) {
|
||||||
mPlayer.setViewResizeMode(false);
|
mPlayer.setViewResizeMode(false);
|
||||||
String url;
|
String url;
|
||||||
@ -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);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user