[*] setBitrate

This commit is contained in:
acgist
2024-04-09 07:16:15 +08:00
parent 0f165a78c4
commit 402318a080
3 changed files with 30 additions and 3 deletions

View File

@@ -8,7 +8,11 @@
#include "sdk/android/native_api/jni/scoped_java_ref.h" #include "sdk/android/native_api/jni/scoped_java_ref.h"
#include "Log.hpp" #include "Log.hpp"
#define private public
#define protected public
#include "RouterCallback.hpp" #include "RouterCallback.hpp"
#undef private
#undef protected
/** /**
* 视频房间头文件 * 视频房间头文件
@@ -175,6 +179,13 @@ namespace acgist {
* @param env JNIEnv * @param env JNIEnv
*/ */
void closeRoom(JNIEnv* env); void closeRoom(JNIEnv* env);
/**
* 设置码率
*
* @param minBitrate 最小码率
* @param maxBitrate 最大码率
*/
void setBitrate(int minBitrate, int maxBitrate);
}; };
} }

View File

@@ -552,6 +552,22 @@ namespace acgist {
this->closeRoomCallback(env); this->closeRoomCallback(env);
} }
void Room::setBitrate(int minBitrate, int maxBitrate) {
if(
this->sendTransport == nullptr ||
this->sendTransport->handler == nullptr ||
this->sendTransport->handler->pc == nullptr ||
this->sendTransport->handler->pc->pc == nullptr
) {
return;
}
webrtc::BitrateSettings settings;
settings.min_bitrate_bps = minBitrate;
settings.max_bitrate_bps = maxBitrate;
settings.start_bitrate_bps = minBitrate;
this->sendTransport->handler->pc->pc->SetBitrate(settings);
}
extern "C" JNIEXPORT jlong JNICALL extern "C" JNIEXPORT jlong JNICALL
Java_com_acgist_taoyao_media_client_Room_nativeNewRoom( Java_com_acgist_taoyao_media_client_Room_nativeNewRoom(
JNIEnv* env, jobject me, JNIEnv* env, jobject me,

View File

@@ -207,7 +207,7 @@ public final class DateUtils {
* *
* @return 日期字符串 * @return 日期字符串
*/ */
public static String format(LocalDate localDate, DateStyle format) { public static final String format(LocalDate localDate, DateStyle format) {
return localDate != null && format != null ? format.getDateTimeFormatter().format(localDate) : null; return localDate != null && format != null ? format.getDateTimeFormatter().format(localDate) : null;
} }
@@ -219,7 +219,7 @@ public final class DateUtils {
* *
* @return 时间字符串 * @return 时间字符串
*/ */
public static String format(LocalTime localTime, TimeStyle format) { public static final String format(LocalTime localTime, TimeStyle format) {
return localTime != null && format != null ? format.getDateTimeFormatter().format(localTime) : null; return localTime != null && format != null ? format.getDateTimeFormatter().format(localTime) : null;
} }
@@ -231,7 +231,7 @@ public final class DateUtils {
* *
* @return 日期时间字符串 * @return 日期时间字符串
*/ */
public static String format(LocalDateTime localDateTime, DateTimeStyle format) { public static final String format(LocalDateTime localDateTime, DateTimeStyle format) {
return localDateTime != null && format != null ? format.getDateTimeFormatter().format(localDateTime) : null; return localDateTime != null && format != null ? format.getDateTimeFormatter().format(localDateTime) : null;
} }