Fixed some minor speaking bugs

This commit is contained in:
WolverinDEV 2020-12-05 21:50:02 +01:00
parent da5f5bfebe
commit 88c4485278
4 changed files with 22 additions and 4 deletions

View File

@ -686,6 +686,10 @@ command_result SpeakingClient::handleCommandRtcSessionReset(Command &command) {
CMD_CHK_AND_INC_FLOOD_POINTS(15);
this->server->rtc_server().reset_rtp_session(this->rtc_client_id);
if(this->getType() == ClientType::CLIENT_TEASPEAK) {
/* registering the broadcast again since rtp session reset resets the broadcasts as well */
this->server->rtc_server().start_broadcast(this->rtc_client_id, 1, 1);
}
return command_result{error::ok};
}

View File

@ -24,12 +24,13 @@ CryptSetupHandler::CryptSetupHandler(VoiceClientConnection *connection) : connec
CryptSetupHandler::CommandHandleResult CryptSetupHandler::handle_command(const std::string_view &payload) {
std::variant<ts::command_result, CommandHandleResult>(CryptSetupHandler::*command_handler)(const ts::command_parser&) = nullptr;
if(payload.starts_with("clientinitiv"))
if(payload.starts_with("clientinitiv")) {
command_handler = &CryptSetupHandler::handleCommandClientInitIv;
else if(payload.starts_with("clientek"))
} else if(payload.starts_with("clientek")) {
command_handler = &CryptSetupHandler::handleCommandClientEk;
else if(payload.starts_with("clientinit"))
} else if(payload.starts_with("clientinit")) {
command_handler = &CryptSetupHandler::handleCommandClientInit;
}
if(!command_handler)
return CommandHandleResult::PASS_THROUGH;

View File

@ -16,6 +16,7 @@ struct NativeCallbacks {
void(*client_stream_assignment)(const void* /* callback data */, uint32_t /* stream id */, uint8_t /* media type */, const void* /* source callback data */);
void(*client_offer_generated)(const void* /* callback data */, const char* /* offer */, size_t /* offer length */);
void(*client_ice_candidate)(const void* /* callback data */, uint32_t /* media line */, const char* /* candidate */, size_t /* candidate length */);
void(*client_stream_start)(const void* /* callback data */, uint32_t /* stream id */, const void* /* source callback data */);
void(*client_stream_stop)(const void* /* callback data */, uint32_t /* stream id */, const void* /* source callback data */);

View File

@ -134,6 +134,17 @@ void librtc_callback_client_offer_generated(const void* callback_data_ptr, const
target_client->rtc_session_pending_describe = true;
}
void librtc_callback_client_ice_candidate(const void* callback_data_ptr, uint32_t media_line, const char* candidate, size_t candidate_length) {
auto callback_data = (LibCallbackData*) callback_data_ptr;
auto target_client = callback_data->weak_ref.lock();
if(!target_client) { return; }
ts::command_builder notify{"notifyrtcicecandidate"};
notify.put_unchecked(0, "medialine", media_line);
notify.put_unchecked(0, "candidate", std::string_view{candidate, candidate_length});
target_client->sendCommand(notify);
}
void librtc_callback_client_audio_start(const void* callback_data_ptr, uint32_t stream_id, const void* source_data_ptr) {
auto callback_data = (LibCallbackData*) callback_data_ptr;
auto source_data = (LibCallbackData*) source_data_ptr;
@ -212,7 +223,7 @@ void librtc_client_whisper_session_reset(const void* callback_data_ptr) {
}
static NativeCallbacks native_callbacks{
.version = 4,
.version = 5,
.log = librtc_callback_log,
.free_client_data = librtc_callback_free_client_data,
@ -221,6 +232,7 @@ static NativeCallbacks native_callbacks{
.client_stream_assignment = librtc_callback_client_stream_assignment,
.client_offer_generated = librtc_callback_client_offer_generated,
.client_ice_candidate = librtc_callback_client_ice_candidate,
.client_stream_start = librtc_callback_client_audio_start,
.client_stream_stop = librtc_callback_client_audio_stop,