提高了帧率,增强直播画质

增加了手动开启推流的逻辑
This commit is contained in:
董宏宇
2021-03-03 14:36:13 +08:00
parent 214d14d049
commit 9ee62fe9af
4 changed files with 13 additions and 7 deletions

View File

@@ -65,7 +65,11 @@ public class LivePlayAndPushActivity extends BaseLiveActivity implements ITraffi
@Override
public void toggleLive(boolean isLive) {
if (isLive) {
liveStreamManager.startLiveStream();
}else{
liveStreamManager.stopLiveStream();
}
}
@Override

View File

@@ -101,7 +101,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="请输入要查看的车机SN"
android:text="F803BB2037EZD00048"
android:text="F803EB2046PZD00149"
android:textColor="#FFFF"
app:layout_constraintBottom_toTopOf="@+id/liveToggleBtn"
app:layout_constraintEnd_toEndOf="parent"

View File

@@ -65,8 +65,8 @@ public class LiveStreamManagerImpl implements ILiveStreamManager {
mLivePushConfig = MoGoLivePushConfig.getInstance();
mLivePushConfig.setWidth(WIDTH);
mLivePushConfig.setHeight(HEIGHT);
mLivePushConfig.setVideoBitrate(5000);
mLivePushConfig.setVideoFPS(25);
mLivePushConfig.setVideoBitrate(6000);
mLivePushConfig.setVideoFPS(30);
mLivePushConfig.setAudioChannels(2);
mLivePushConfig.setAudioSampleRate(44100);
mLivePushConfig.setAudioFormat(AudioFormat.ENCODING_PCM_16BIT);
@@ -185,13 +185,13 @@ public class LiveStreamManagerImpl implements ILiveStreamManager {
if (C1.equals(videoChannel)) {
// 停止直播
if (status == PUSH_STOP) {
PushService.startService(mApplication, PushService.ACTION_STOP_RTMP_PUSH);
stopLiveStream();
// 释放资源
CameraFrameManager.getInstance().release();
}
// 开始直播
else if (status == PUSH_START) {
PushService.startService(mApplication, PushService.ACTION_START_RTMP_PUSH);
startLiveStream();
}
// 强制关闭直播
else if (status == PUSH_FORCED_STOP) {

View File

@@ -173,7 +173,7 @@ public class MoGoLiveManager {
* @param application 上下文
* @param livePushConfig 是否需要配置
*/
public void init(Application application, MoGoLivePushConfig livePushConfig) {
public MoGoLiveManager init(Application application, MoGoLivePushConfig livePushConfig) {
mApplication = application;
mLivePushConfig = livePushConfig;
// 通过 advancedConfig 设置 uuid 过滤字段,设置之后 SDK 只会抛出前 12 个字节为开发者所设置 uuid 的 SEI
@@ -189,6 +189,8 @@ public class MoGoLiveManager {
// 登录以前用户SN为房间ID的房间
loginRoom(mLivePushConfig.getDevicesId(), mLivePushConfig.getDevicesId());
return this;
}
/**