[*] setBitrate
This commit is contained in:
@@ -8,7 +8,11 @@
|
||||
#include "sdk/android/native_api/jni/scoped_java_ref.h"
|
||||
|
||||
#include "Log.hpp"
|
||||
#define private public
|
||||
#define protected public
|
||||
#include "RouterCallback.hpp"
|
||||
#undef private
|
||||
#undef protected
|
||||
|
||||
/**
|
||||
* 视频房间头文件
|
||||
@@ -175,6 +179,13 @@ namespace acgist {
|
||||
* @param env JNIEnv
|
||||
*/
|
||||
void closeRoom(JNIEnv* env);
|
||||
/**
|
||||
* 设置码率
|
||||
*
|
||||
* @param minBitrate 最小码率
|
||||
* @param maxBitrate 最大码率
|
||||
*/
|
||||
void setBitrate(int minBitrate, int maxBitrate);
|
||||
};
|
||||
|
||||
}
|
||||
@@ -552,6 +552,22 @@ namespace acgist {
|
||||
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
|
||||
Java_com_acgist_taoyao_media_client_Room_nativeNewRoom(
|
||||
JNIEnv* env, jobject me,
|
||||
|
||||
Reference in New Issue
Block a user